DATAJPA-253 - Fixed application of Specifications.not(…).

Specifications.not(…) now also gets applied correctly when used without where(…) wrapper. Polished Specifications class, JavaDoc and added not null assertions.
This commit is contained in:
Oliver Gierke
2012-08-30 11:36:09 +02:00
parent a9cfe73511
commit 918099e395
2 changed files with 36 additions and 21 deletions

View File

@@ -443,7 +443,21 @@ public class UserRepositoryTests {
flushTestUsers();
Specification<User> spec = where(userHasFirstname("Oliver")).or(userHasLastname("Arrasz"));
assertThat(repository.findAll(spec).size(), is(2));
assertThat(repository.findAll(spec), hasSize(2));
}
/**
* @see DATAJPA-253
*/
@Test
public void executesNegatingSpecificationCorrectly() {
flushTestUsers();
Specification<User> spec = not(userHasFirstname("Oliver")).and(userHasLastname("Arrasz"));
List<User> result = repository.findAll(spec);
assertThat(result, hasSize(1));
assertThat(result, hasItem(secondUser));
}
@Test