UserBrowserBean implements UserBrowser { @Override public UserDto getUser(String username) { UserFilterFactory filterFactory = userDao.createQueryModifier().getQueryFilterFactory(); QueryFilter<User> filter = filterFactory.byUsername(username); User user = userDao.findFirstResultBy(filter); if (user != null) { return new UserDto(user.getId(), user.getUsername(), user.getHomeDir()); } return null; }  @Override List<UserDto> getUsers(); @Override UserDto getUser(String username); @Override UserDto getUser(long id); @Override Long getUserId(String username); @Override OrganizationDto getOrganization(String username); @Override boolean isAdmin(String username); @Override String getEmail(String username);  }
@Test public void shouldReturnUserDtoByUsername() { UserDto tested = userBrowser.getUser("test"); UserDto expected = new UserDto(999, "test", "/home"); Assert.assertEquals(expected, tested); }