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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user