@Test public void testRisator() { UserDTO user = repo.userByFirstNameAndLastName("Richard", "Strauss"); assertThat(user.getUserName(), is(equalTo("risator"))); }
@Override public UserDTO userByFirstNameAndLastName(String firstName, String lastName) { LOGGER.info("fetching user by firstname and lastname"); Optional<UserDTO> user = users.stream() .filter(p -> p.getFirstName().equals(firstName) && p.getLastName().equals(lastName)).findFirst(); return user.isPresent() ? user.get() : null; }
JsonUserRepository implements UserRepository { @Override public UserDTO userByFirstNameAndLastName(String firstName, String lastName) { LOGGER.info("fetching user by firstname and lastname"); Optional<UserDTO> user = users.stream() .filter(p -> p.getFirstName().equals(firstName) && p.getLastName().equals(lastName)).findFirst(); return user.isPresent() ? user.get() : null; } }
JsonUserRepository implements UserRepository { @Override public UserDTO userByFirstNameAndLastName(String firstName, String lastName) { LOGGER.info("fetching user by firstname and lastname"); Optional<UserDTO> user = users.stream() .filter(p -> p.getFirstName().equals(firstName) && p.getLastName().equals(lastName)).findFirst(); return user.isPresent() ? user.get() : null; }  }
JsonUserRepository implements UserRepository { @Override public UserDTO userByFirstNameAndLastName(String firstName, String lastName) { LOGGER.info("fetching user by firstname and lastname"); Optional<UserDTO> user = users.stream() .filter(p -> p.getFirstName().equals(firstName) && p.getLastName().equals(lastName)).findFirst(); return user.isPresent() ? user.get() : null; }  @Override List<UserDTO> fetchAllUsers(); @Override UserDTO firstUser(); @Override UserDTO userByFirstNameAndLastName(String firstName, String lastName); }
JsonUserRepository implements UserRepository { @Override public UserDTO userByFirstNameAndLastName(String firstName, String lastName) { LOGGER.info("fetching user by firstname and lastname"); Optional<UserDTO> user = users.stream() .filter(p -> p.getFirstName().equals(firstName) && p.getLastName().equals(lastName)).findFirst(); return user.isPresent() ? user.get() : null; }  @Override List<UserDTO> fetchAllUsers(); @Override UserDTO firstUser(); @Override UserDTO userByFirstNameAndLastName(String firstName, String lastName);  }