|
19 | 19 | import static org.hamcrest.core.Is.*;
|
20 | 20 | import static org.hamcrest.core.IsEqual.*;
|
21 | 21 | import static org.junit.Assert.*;
|
22 |
| -import static org.springframework.data.mongodb.core.DocumentTestUtils.assertTypeHint; |
| 22 | +import static org.springframework.data.mongodb.core.DocumentTestUtils.*; |
23 | 23 | import static org.springframework.data.mongodb.core.query.Criteria.*;
|
24 | 24 | import static org.springframework.data.mongodb.core.query.Query.*;
|
25 | 25 |
|
| 26 | +import lombok.Data; |
| 27 | + |
26 | 28 | import java.net.UnknownHostException;
|
27 | 29 | import java.util.Arrays;
|
28 | 30 | import java.util.LinkedHashMap;
|
|
46 | 48 | import com.mongodb.MongoClient;
|
47 | 49 | import com.mongodb.WriteConcern;
|
48 | 50 |
|
49 |
| -import lombok.Data; |
50 |
| - |
51 | 51 | /**
|
52 | 52 | * Integration test for Mapping Events.
|
53 | 53 | *
|
@@ -390,6 +390,24 @@ public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingMapOfDBRef() th
|
390 | 390 | is(equalTo(RELATED_COLLECTION_NAME)));
|
391 | 391 | }
|
392 | 392 |
|
| 393 | + @Test // DATAMONGO-1823 |
| 394 | + public void publishesAfterConvertEventForFindQueriesUsingProjections() { |
| 395 | + |
| 396 | + PersonPojoStringId entity = new PersonPojoStringId("1", "Text"); |
| 397 | + template.insert(entity); |
| 398 | + |
| 399 | + template.query(PersonPojoStringId.class).matching(query(where("id").is(entity.getId()))).all(); |
| 400 | + |
| 401 | + assertThat(simpleMappingEventListener.onAfterLoadEvents.size(), is(1)); |
| 402 | + assertThat(simpleMappingEventListener.onAfterLoadEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); |
| 403 | + |
| 404 | + assertThat(simpleMappingEventListener.onBeforeConvertEvents.size(), is(1)); |
| 405 | + assertThat(simpleMappingEventListener.onBeforeConvertEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); |
| 406 | + |
| 407 | + assertThat(simpleMappingEventListener.onAfterConvertEvents.size(), is(1)); |
| 408 | + assertThat(simpleMappingEventListener.onAfterConvertEvents.get(0).getCollectionName(), is(COLLECTION_NAME)); |
| 409 | + } |
| 410 | + |
393 | 411 | private void comparePersonAndDocument(PersonPojoStringId p, PersonPojoStringId p2, org.bson.Document document) {
|
394 | 412 |
|
395 | 413 | assertEquals(p.getId(), p2.getId());
|
|
0 commit comments