@Test public void getNonexistentUser() { assertThat(userDAO.getHashedPassword("non-user")).isEmpty(); }
public Optional<String> getHashedPassword(String name) { String r = dslContext .select(USERS.PASSWORD_HASH) .from(USERS) .where(USERS.USERNAME.eq(name)) .fetchOne(USERS.PASSWORD_HASH); return Optional.ofNullable(r); }
UserDAO { public Optional<String> getHashedPassword(String name) { String r = dslContext .select(USERS.PASSWORD_HASH) .from(USERS) .where(USERS.USERNAME.eq(name)) .fetchOne(USERS.PASSWORD_HASH); return Optional.ofNullable(r); } }
UserDAO { public Optional<String> getHashedPassword(String name) { String r = dslContext .select(USERS.PASSWORD_HASH) .from(USERS) .where(USERS.USERNAME.eq(name)) .fetchOne(USERS.PASSWORD_HASH); return Optional.ofNullable(r); } UserDAO(DSLContext dslContext); }
UserDAO { public Optional<String> getHashedPassword(String name) { String r = dslContext .select(USERS.PASSWORD_HASH) .from(USERS) .where(USERS.USERNAME.eq(name)) .fetchOne(USERS.PASSWORD_HASH); return Optional.ofNullable(r); } UserDAO(DSLContext dslContext); Optional<String> getHashedPassword(String name); void createUserAt(String user, String password, OffsetDateTime created, OffsetDateTime updated); void createUser(String user, String password); }
UserDAO { public Optional<String> getHashedPassword(String name) { String r = dslContext .select(USERS.PASSWORD_HASH) .from(USERS) .where(USERS.USERNAME.eq(name)) .fetchOne(USERS.PASSWORD_HASH); return Optional.ofNullable(r); } UserDAO(DSLContext dslContext); Optional<String> getHashedPassword(String name); void createUserAt(String user, String password, OffsetDateTime created, OffsetDateTime updated); void createUser(String user, String password);  }