Skip to content

Commit

Permalink
DATAMONGO-671 - Added integration tests to show lookups by date are w…
Browse files Browse the repository at this point in the history
…orking.
  • Loading branch information
odrotbohm committed Jul 3, 2013
1 parent 4f57712 commit ceef18d
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -149,6 +149,7 @@ protected void cleanDb() {
template.dropCollection(Sample.class);
template.dropCollection(MyPerson.class);
template.dropCollection(TypeWithFieldAnnotation.class);
template.dropCollection(TypeWithDate.class);
template.dropCollection("collection");
template.dropCollection("personX");
}
Expand Down Expand Up @@ -1642,6 +1643,24 @@ public void updateConsidersMappingAnnotations() {
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;
Expand Down Expand Up @@ -1721,4 +1740,10 @@ static class TypeWithFieldAnnotation {
@Id ObjectId id;
@Field("email") String emailAddress;
}

static class TypeWithDate {

@Id String id;
Date date;
}
}

0 comments on commit ceef18d

Please sign in to comment.