@Test public void getAccountByUsername_shouldReturnNullForNonExistingAccount() { Account account = accountDao.getAccountByUsername("non_existing_username"); assertThat(account, nullValue()); }
public Account getAccountByUsername(final String username) { checkNotNull(emptyToNull(username), "Argument[username] must not be empty or null"); DBObject accountObj = collection.findOne(new BasicDBObject("_id", username)); Account account = (accountObj != null) ? Account.fromDBObject(accountObj) : null; logger.info("Found for username[{}] following account[{}]", username, account); return account; }
AccountDao extends AbstractBaseDao<Account, String> implements AccountMapper { public Account getAccountByUsername(final String username) { checkNotNull(emptyToNull(username), "Argument[username] must not be empty or null"); DBObject accountObj = collection.findOne(new BasicDBObject("_id", username)); Account account = (accountObj != null) ? Account.fromDBObject(accountObj) : null; logger.info("Found for username[{}] following account[{}]", username, account); return account; } }
AccountDao extends AbstractBaseDao<Account, String> implements AccountMapper { public Account getAccountByUsername(final String username) { checkNotNull(emptyToNull(username), "Argument[username] must not be empty or null"); DBObject accountObj = collection.findOne(new BasicDBObject("_id", username)); Account account = (accountObj != null) ? Account.fromDBObject(accountObj) : null; logger.info("Found for username[{}] following account[{}]", username, account); return account; } AccountDao(String collectionName); }
AccountDao extends AbstractBaseDao<Account, String> implements AccountMapper { public Account getAccountByUsername(final String username) { checkNotNull(emptyToNull(username), "Argument[username] must not be empty or null"); DBObject accountObj = collection.findOne(new BasicDBObject("_id", username)); Account account = (accountObj != null) ? Account.fromDBObject(accountObj) : null; logger.info("Found for username[{}] following account[{}]", username, account); return account; } AccountDao(String collectionName); Account getAccountByUsername(final String username); Account getAccountByUsernameAndPassword(final String username, final String password); void insertAccount(@Nonnull final Account account); void updateAccount(@Nonnull final Account account); void deleteAccount(@Nonnull final String username); void insertProfile(final Account account); void insertSignon(final Account account); void updateProfile(final Account account); void updateSignon(final Account account); }
AccountDao extends AbstractBaseDao<Account, String> implements AccountMapper { public Account getAccountByUsername(final String username) { checkNotNull(emptyToNull(username), "Argument[username] must not be empty or null"); DBObject accountObj = collection.findOne(new BasicDBObject("_id", username)); Account account = (accountObj != null) ? Account.fromDBObject(accountObj) : null; logger.info("Found for username[{}] following account[{}]", username, account); return account; } AccountDao(String collectionName); Account getAccountByUsername(final String username); Account getAccountByUsernameAndPassword(final String username, final String password); void insertAccount(@Nonnull final Account account); void updateAccount(@Nonnull final Account account); void deleteAccount(@Nonnull final String username); void insertProfile(final Account account); void insertSignon(final Account account); void updateProfile(final Account account); void updateSignon(final Account account);  }