DATAMONGO-521 - Added test case to show that repository AND query works.

This commit is contained in:
Oliver Gierke
2012-09-03 16:46:53 +02:00
parent eda8200d51
commit 114489d19a
3 changed files with 20 additions and 1 deletions

View File

@@ -506,4 +506,21 @@ public abstract class AbstractPersonRepositoryIntegrationTests {
assertThat(result, not(hasItem(dave)));
assertThat(result, hasSize(5));
}
/**
* @see DATAMONGO-521
*/
@Test
public void executesAndQueryCorrectly() {
List<Person> result = repository.findByFirstnameAndLastname("Dave", "Matthews");
assertThat(result, hasSize(1));
assertThat(result, hasItem(dave));
result = repository.findByFirstnameAndLastname("Oliver August", "Matthews");
assertThat(result, hasSize(1));
assertThat(result, hasItem(oliver));
}
}

View File

@@ -106,6 +106,8 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query
*/
List<Person> findByFirstnameNotIn(Collection<String> firstnames);
List<Person> findByFirstnameAndLastname(String firstname, String lastname);
/**
* Returns all {@link Person}s with an age between the two given values.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2010-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.