diff --git a/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java b/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java index f20ece9f..0a2f1f3b 100644 --- a/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java +++ b/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java @@ -223,6 +223,28 @@ public void getEventTest() throws ApiException { assertTrue(response.getTags().isEmpty()); } + /** + * Validates that the SDK can deserialize an event response that contains unknown fields, ignoring + * them without failing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getEventWithUnknownFieldTest() throws ApiException { + addMock( + "getEvent", + MOCK_REQUEST_ID, + invocation -> { + return mockFileToResponse( + 200, invocation, "mocks/events/get_event_200_with_unknown_field.json", Event.class); + }); + + Event response = api.getEvent(MOCK_REQUEST_ID); + assertNotNull(response); + assertNotNull(response.getIdentification()); + assertEquals("Ibk1527CUFmcnjLwIs4A9", response.getIdentification().getVisitorId()); + } + @Test public void updateEventLinkedIdRequest() throws ApiException { final String LINKED_ID = "myLinkedId"; @@ -482,6 +504,7 @@ public void searchEventsMaximumParamsTest() throws ApiException { final SearchEventsIncrementalIdentificationStatus INCREMENTAL_IDENTIFICATION_STATUS = SearchEventsIncrementalIdentificationStatus.PARTIALLY_COMPLETED; final Boolean SIMULATOR = true; + final List SOURCE = Arrays.asList(SearchEventsSource.EDGE); Map expectedQueryParams = new HashMap<>(); expectedQueryParams.put("limit", String.valueOf(LIMIT)); @@ -534,7 +557,8 @@ public void searchEventsMaximumParamsTest() throws ApiException { + BOT_INFO_IDENTITY.size() + BOT_INFO_CONFIDENCE.size() + BOT_INFO_PROVIDER.size() - + BOT_INFO_NAME.size(); + + BOT_INFO_NAME.size() + + SOURCE.size(); addMock( "searchEvents", @@ -553,6 +577,7 @@ public void searchEventsMaximumParamsTest() throws ApiException { assertListContainsPairs(queryParams, "bot_info_confidence", BOT_INFO_CONFIDENCE); assertListContainsPairs(queryParams, "bot_info_provider", BOT_INFO_PROVIDER); assertListContainsPairs(queryParams, "bot_info_name", BOT_INFO_NAME); + assertListContainsPairs(queryParams, "source", SOURCE); return mockFileToResponse( 200, invocation, "mocks/events/search/get_event_search_200.json", EventSearch.class); @@ -608,7 +633,8 @@ public void searchEventsMaximumParamsTest() throws ApiException { .setTorNode(TOR_NODE) .setHighRecallId(HIGH_RECALL_ID) .setIncrementalIdentificationStatus(INCREMENTAL_IDENTIFICATION_STATUS) - .setSimulator(SIMULATOR)); + .setSimulator(SIMULATOR) + .setSource(SOURCE)); List events = response.getEvents(); assertEquals(events.size(), 1); }