@Test public void findByLoginName() { final UserMapper sut = new UserMapper(dataSource(), new IntegerIdentityMap<User>()); final User user = sut.findByLoginName("Baz"); assertThat(user.getId(), is(3)); assertThat(user.getLoginName(), is("Baz")); assertThat(user.getHashedUserData(), is("aa82cc74b4a932c06d4ea5a9ac38cf5e")); }
@Test public void findByLoginName_caches() { final UserMapper sut = new UserMapper(dataSource(), new IntegerIdentityMap<User>()); final User user = sut.findByLoginName("Baz"); assertThat(user, is(sameInstance(sut.findByLoginName("Baz")))); }