codereligion / beast

Provides utilities for testing Java beans.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add new test for clone implementation

SierraGolf opened this issue · comments

aspects

  • presence
    • is the method actually declared
  • completeness
    • every property which is not excluded must be copied, meaning the original and the copy must have the same value (not reference) after copying
    • one can not assure 100% that the property is really copied or if by accident the default value of the object matches the values used for testing
  • deep copy
    • every non-immutable and non-primitive property must be a deep copy, meaning the reference of the original and the copy must be different
    • can that actually be achieved with the current implementation of cg-proxy for interfaces, abstract and concrete classes?
    • may this be optional?
  • null-safety
    • the implementation of the clone method must be able to handle null values for every property which is not excluded

notes

  • does it make sense to compare the toString, equals and hashCode results of the cloned object to its original?