Fixed test @Transient

This commit is contained in:
alex-semenyuk 2015-08-22 12:22:13 +02:00
parent 11c364d9cf
commit 67d636aaf9
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package org.baeldung.mongotemplate;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.nullValue;
import java.util.List;
@ -25,6 +26,7 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MongoConfig.class)
public class MongoTemplateQueryIntegrationTest {
@ -189,6 +191,6 @@ public class MongoTemplateQueryIntegrationTest {
user.setYearOfBirth(1985);
mongoTemplate.insert(user);
assertThat(user.getYearOfBirth(), is(1985));
assertThat(mongoTemplate.findOne(Query.query(Criteria.where("name").is("Alex")), User.class).getYearOfBirth(), is(nullValue()));
}
}