DATAMONGO-537 - Guard index creation tests against changing method orders.

This commit is contained in:
Oliver Gierke
2012-09-12 10:11:26 +02:00
parent d5f8285d51
commit e0b0792643

View File

@@ -44,11 +44,9 @@ import com.mongodb.MongoException;
@ContextConfiguration
public class RepositoryIndexCreationIntegrationTests {
@Autowired
MongoOperations operations;
@Autowired MongoOperations operations;
@Autowired
PersonRepository repository;
@Autowired PersonRepository repository;
@After
public void tearDown() {
@@ -72,12 +70,13 @@ public class RepositoryIndexCreationIntegrationTests {
public void testname() {
operations.execute(Person.class, new CollectionCallback<Void>() {
@SuppressWarnings("unchecked")
public Void doInCollection(DBCollection collection) throws MongoException, DataAccessException {
List<DBObject> indexInfo = collection.getIndexInfo();
assertThat(indexInfo.isEmpty(), is(false));
assertThat(indexInfo.size(), is(greaterThan(2)));
assertThat(getIndexNamesFrom(indexInfo), hasItems("findByLastnameLike", "findByFirstnameLike"));
assertThat(getIndexNamesFrom(indexInfo), hasItems(startsWith("findByLastname"), startsWith("findByFirstname")));
return null;
}