https://github.com/benehiko/perago-techtest
https://github.com/benehiko/perago-techtest
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/benehiko/perago-techtest
- Owner: Benehiko
- Created: 2021-01-25T18:35:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-26T18:20:37.000Z (over 4 years ago)
- Last Synced: 2025-02-13T12:17:18.462Z (4 months ago)
- Language: Java
- Size: 98.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
Perago Technical Test
`practical-test.pdf` is the original document which describes the full use case.
The objective is to write a generic library to calculate the difference
between two objects - **original** and **modified** - and return a `diff`
object. The library also has to take into consideration
nested objects, cyclic dependencies and collections such as shown below.```java
class Bar {
private String name;
private String lastName;
}class Foo {
// nested object
private Bar bar;
// cyclic dependency on itself
private Foo friend;
// collections
private Set nicknames;
}
```The library should also be able to restore the **modified** object from its
saved `diff` state.## Assumptions
- Assumed Java 8 can be used
- Minimal dependencies should be used
- Maven should be used to run the project build
- JUint5 can be used to run the tests### Run the Tests
```mvn test```
### Some notable resources
- https://stackoverflow.com/questions/48321997/how-to-compare-two-objects-and-find-the-fields-properties-changed
- https://www.javatpoint.com/java-field-setaccessible-method
- https://stackoverflow.com/a/7596565
- https://stackoverflow.com/a/14034555