@Test public void findUniqueReturnsResult() { User jonDoe = usersTemplate.findUnique("SELECT u FROM /Users u WHERE u.username = $1", "jonDoe"); assertThat(jonDoe).isNotNull(); assertThat(jonDoe).isEqualTo(getUser("jonDoe")); }
@Test(expected = InvalidDataAccessApiUsageException.class) public void findUnqiueReturnsTooManyResults() { usersTemplate.findUnique("SELECT u FROM /Users u WHERE u.username LIKE $1", "%Doe"); }
@Test(expected = InvalidDataAccessApiUsageException.class) public void findUniqueReturnsNoResult() { usersTemplate.findUnique("SELECT u FROM /Users u WHERE u.username = $1", "benDover"); }