@Test public void shouldFindOneUser() { final User bob = UserTestUtils.createBob(); when(userRepositoryMock.findOne(isA(Example.class))).thenReturn(Optional.of(bob)); final User user = testSubject.get(bob.getId()); assertThat(user).isEqualToComparingFieldByField(bob); }
public User get(long id) { return userRepository.findOne(Example.of(new User().setId(id))).orElse(null); }
UserService { public User get(long id) { return userRepository.findOne(Example.of(new User().setId(id))).orElse(null); } }
UserService { public User get(long id) { return userRepository.findOne(Example.of(new User().setId(id))).orElse(null); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); }
UserService { public User get(long id) { return userRepository.findOne(Example.of(new User().setId(id))).orElse(null); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); List<User> list(); User create(String name, String currency); User get(long id); String getTestProperty(); }
UserService { public User get(long id) { return userRepository.findOne(Example.of(new User().setId(id))).orElse(null); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); List<User> list(); User create(String name, String currency); User get(long id); String getTestProperty();  }