@Test public void shouldCreateUser() throws Exception { when(userRepositoryMock.save(isA(User.class))).thenAnswer(invocation -> invocation.getArgument(0)); final User user = testSubject.create("Clark", "$"); assertThat(user.getName()).isEqualTo("Clark"); assertThat(user.getCurrency()).isEqualTo("$"); }
public User create(String name, String currency) { final User user = new User(name, currency); return userRepository.save(user); }
UserService { public User create(String name, String currency) { final User user = new User(name, currency); return userRepository.save(user); } }
UserService { public User create(String name, String currency) { final User user = new User(name, currency); return userRepository.save(user); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); }
UserService { public User create(String name, String currency) { final User user = new User(name, currency); return userRepository.save(user); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); List<User> list(); User create(String name, String currency); User get(long id); String getTestProperty(); }
UserService { public User create(String name, String currency) { final User user = new User(name, currency); return userRepository.save(user); } @Autowired  UserService(UserRepository userRepository, UserManagementProperties userManagementProperties); List<User> list(); User create(String name, String currency); User get(long id); String getTestProperty();  }