这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@3ga01
Copy link
Contributor

@3ga01 3ga01 commented Dec 2, 2023


This pull request introduces a set of JUnit tests within the TestCases class to validate the behavior of various object copying scenarios. Each test focuses on different aspects of object copying, including deep copy, shallow copy, and string and integer objects.


  1. testDeepCopyWithDistinctValues:

    • Creates two instances of the Entity class and verifies that modifying one instance does not affect the other, demonstrating a deep copy with distinct values.
  2. testDistinctObjects:

    • Validates that two separate instances of the Entity class have distinct identity hash codes, ensuring they are distinct objects.
  3. testShallowCopyWithDistinctValues:

    • Illustrates a shallow copy scenario where modifying one instance reflects changes in another.
  4. testStringObjectWithShallowCopy:

    • Examines a string object scenario with a shallow copy, ensuring that both the original and duplicate strings have the same hash code.
  5. testStringObjectUpdateWithShallowCopy:

    • Extends the string object scenario to demonstrate that updating the duplicate string results in distinct hash codes, emphasizing the impact of changes in a shallow copy.
  6. testIntegerWithShallowCopy:

    • Tests the behavior of integer objects with a shallow copy, confirming that modifying the duplicate integer does not affect the original.

3ga01 and others added 11 commits November 22, 2023 23:47
Signed-off-by: Emmanuel Mireku Omari <omariemmanuel91@gmail.com>
Signed-off-by: Emmanuel Mireku Omari <omariemmanuel91@gmail.com>
Signed-off-by: Emmanuel Mireku Omari <omariemmanuel91@gmail.com>
@3ga01 3ga01 closed this Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants