### Question:
JpaPersonRepository implements PersonRepository { @Override public Person findByUsername(String username) { TypedQuery<JpaPerson> query = manager.createNamedQuery(JpaPerson.FIND_BY_USERNAME, JpaPerson.class); query.setParameter(JpaPerson.USERNAME_PARAM, username); return getSingleResult(query.getResultList()); }  @Override Person findByUsername(String username); @Override List<Person> findAllConnectedPeople(String username); @Override List<Person> findAllConnectedPeople(String username, String appId); @Override List<Person> findAllConnectedPeopleWithFriend(String username, String friendUsername); @Override List<Person> findFriends(String username); @Override List<Person> findFriends(String username, String appId); @Override List<Person> findFriendsWithFriend(String username, String friendUsername); @Override List<Person> findByGroup(String groupId); @Override List<Person> findByGroup(String groupId, String appId); @Override List<Person> findByGroupWithFriend(String groupId, String friendUsername); @Override Class<? extends Person> getType(); @Override Person get(String id); @Override Person save(Person item); @Override void delete(Person item); @Override boolean addFriend(String friendUsername, String username); @Override void removeFriend(String friendUsername, String username); @Override HashMap<String, List<Person>> findFriendsAndRequests(String username); @Override List<Person> findFriendRequestsSent(String username); @Override List<Person> findFriendRequestsReceived(String username); @Override boolean acceptFriendRequest(String friendUsername, String username); @Override int removeAllFriendsAndRequests(String userid); @Override List<Person> getAll(); @Override List<Person> getLimitedList(int offset, int limit); @Override int getCountAll();  }### Answer:
@Test public void findByUsername_valid() { Person person = repository.findByUsername(VALID_USER); assertThat(person, is(not(nullValue()))); assertThat(person.getUsername(), is(equalTo(VALID_USER))); }
@Test public void findByUsername_null() { Person person = repository.findByUsername(INVALID_USERNAME); assertThat(person, is(nullValue())); }