|
18 | 18 |
|
19 | 19 | import com.basistech.rosette.apimodel.jackson.ApiModelMixinModule; |
20 | 20 | import com.basistech.rosette.apimodel.jackson.DocumentRequestMixin; |
| 21 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 22 | +import com.fasterxml.jackson.core.type.TypeReference; |
21 | 23 | import com.fasterxml.jackson.databind.ObjectMapper; |
22 | 24 | import com.fasterxml.jackson.databind.ObjectWriter; |
23 | 25 | import com.google.common.collect.Lists; |
24 | 26 | import org.junit.jupiter.api.BeforeEach; |
| 27 | +import org.junit.jupiter.api.Test; |
25 | 28 | import org.junit.jupiter.params.ParameterizedTest; |
26 | 29 | import org.junit.jupiter.params.provider.Arguments; |
27 | 30 | import org.junit.jupiter.params.provider.MethodSource; |
|
43 | 46 | import java.util.stream.Stream; |
44 | 47 |
|
45 | 48 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 49 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
46 | 50 | import static org.junit.jupiter.api.Assertions.fail; |
47 | 51 |
|
48 | 52 | @SuppressWarnings("PMD.UnusedPrivateMethod") // Parameterized Tests |
@@ -376,4 +380,12 @@ private Object createObjectOfType(Type type) { |
376 | 380 | } |
377 | 381 | return object; |
378 | 382 | } |
| 383 | + |
| 384 | + @Test |
| 385 | + void doNotDeserializeGenre() throws JsonProcessingException { |
| 386 | + String json = "{\"content\": \"foo\", \"genre\":\"foo\"}"; |
| 387 | + // Ensure that the document request no longer deserializes genre |
| 388 | + Request request = mapper.readValue(json, new TypeReference<DocumentRequest<EntitiesOptions>>() { }); |
| 389 | + assertTrue(mapper.writeValueAsString(request).indexOf("genre") == -1); |
| 390 | + } |
379 | 391 | } |
0 commit comments