Browse Source

DATAMONGO-671 - Added integration tests to show lookups by date are working.

pull/46/merge
Oliver Gierke 13 years ago
parent
commit
ceef18d7a4
  1. 25
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java

25
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java

@ -149,6 +149,7 @@ public class MongoTemplateTests { @@ -149,6 +149,7 @@ public class MongoTemplateTests {
template.dropCollection(Sample.class);
template.dropCollection(MyPerson.class);
template.dropCollection(TypeWithFieldAnnotation.class);
template.dropCollection(TypeWithDate.class);
template.dropCollection("collection");
template.dropCollection("personX");
}
@ -1642,6 +1643,24 @@ public class MongoTemplateTests { @@ -1642,6 +1643,24 @@ public class MongoTemplateTests {
assertThat(result.emailAddress, is("new"));
}
/**
* @see DATAMONGO-671
*/
@Test
public void findsEntityByDateReference() {
TypeWithDate entity = new TypeWithDate();
entity.date = new Date();
template.save(entity);
Query query = query(where("date").lt(new Date()));
List<TypeWithDate> result = template.find(query, TypeWithDate.class);
assertThat(result, hasSize(1));
assertThat(result.get(0).date, is(notNullValue()));
}
static class MyId {
String first;
@ -1721,4 +1740,10 @@ public class MongoTemplateTests { @@ -1721,4 +1740,10 @@ public class MongoTemplateTests {
@Id ObjectId id;
@Field("email") String emailAddress;
}
static class TypeWithDate {
@Id String id;
Date date;
}
}

Loading…
Cancel
Save