@Test void addEntity() { String password = "password"; User user = mock(User.class); when(user.getPassword()).thenReturn(password); userRepositoryDecorator.add(user); verify(passwordEncoder).encode(password); verify(delegateRepository).add(user); }
@Override public void add(User entity) { encodePassword(entity); delegate().add(entity); }
UserRepositoryDecorator extends AbstractRepositoryDecorator<User> { @Override public void add(User entity) { encodePassword(entity); delegate().add(entity); } }
UserRepositoryDecorator extends AbstractRepositoryDecorator<User> { @Override public void add(User entity) { encodePassword(entity); delegate().add(entity); } UserRepositoryDecorator(Repository<User> delegateRepository, PasswordEncoder passwordEncoder); }
UserRepositoryDecorator extends AbstractRepositoryDecorator<User> { @Override public void add(User entity) { encodePassword(entity); delegate().add(entity); } UserRepositoryDecorator(Repository<User> delegateRepository, PasswordEncoder passwordEncoder); @Override void add(User entity); @Override void update(User entity); @Override Integer add(Stream<User> entities); @Override void update(Stream<User> entities); @Override void delete(User entity); @Override void delete(Stream<User> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); }
UserRepositoryDecorator extends AbstractRepositoryDecorator<User> { @Override public void add(User entity) { encodePassword(entity); delegate().add(entity); } UserRepositoryDecorator(Repository<User> delegateRepository, PasswordEncoder passwordEncoder); @Override void add(User entity); @Override void update(User entity); @Override Integer add(Stream<User> entities); @Override void update(Stream<User> entities); @Override void delete(User entity); @Override void delete(Stream<User> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll();  }