### Question:
AdministratorLoginDaoImpl implements AdministratorLoginDao { @Transactional public AdministratorLoginResult findUser(final String username, final String password) { final AdministratorLoginResult result = new AdministratorLoginResult(); final Query query = em.createQuery(GET_USER_JQL); query.setParameter("username", username); query.setParameter("enabled", Authorize.ENABLE); final List<Administrator> list = query.getResultList(); if (checkUsername(list)) { LOGGER.info("User \"{}\" has not exist", username); result.setStatus(AdministratorLoginStatus.INVALID_USERNAME); return result; } final Administrator admin = list.get(0); if (checkPassword(password, admin)) { LOGGER.info("The user \"{}\"'s password is wrong", username); result.setStatus(AdministratorLoginStatus.INVALID_PASSWORD); return result; } LOGGER.info("The user {} has found", username); loginSuccessfull(result, admin); return result; }  @Transactional AdministratorLoginResult findUser(final String username,
            final String password); @PersistenceContext void setEntityManager(final EntityManager em);  }### Answer:
@Test public void loginInvalidUsername() throws Exception { configureMockObjects(Collections.emptyList()); final AdministratorLoginResult result = dao.findUser(username, password); assertEquals(AdministratorLoginStatus.INVALID_USERNAME, result.getStatus()); verifyMockObjects(); }
@Test public void loginInvalidPassword() throws Exception { final List<Administrator> list = createAdminList(username, "different"); configureMockObjects(list); final AdministratorLoginResult result = dao.findUser(username, password); assertEquals(AdministratorLoginStatus.INVALID_PASSWORD, result.getStatus()); verifyMockObjects(); }