Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User {
- private int id;
- private String email;
- User(int id, String email) {
- this.id = id
- this.email = email
- }
- // equals, hashcode
- }
- @Test
- public void assertUsers() {
- Set<User> expected = new HashSet<>() {
- {
- add(new User(1, "1@qwerty.com"));
- add(new User(3, "2@qwerty.com"));
- add(new User(5, "3@qwerty.com"));
- add(new User(7, "4@qwerty.com"));
- }
- }
- Set<User> actual = new HashSet<>() {
- {
- add(new User(2, "1@qwerty.com"));
- add(new User(4, "2@qwerty.com"));
- add(new User(6, "3@qwerty.com"));
- add(new User(8, "4@qwerty.com"));
- }
- }
- assertEquals(expected, actual); // should return true
- }
- class IdConverter {
- // internal id - external id
- public static Map<Integer, Integer> getIdRelation() {
- Map<Integer, Integer> id_relation = new HashMap<>();
- id_relation.put(1, 2);
- id_relation.put(3, 4);
- id_relation.put(5, 6);
- id_relation.put(7, 8);
- return id_relation;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement