Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -482,6 +504,7 @@ public void searchEventsMaximumParamsTest() throws ApiException {
final SearchEventsIncrementalIdentificationStatus INCREMENTAL_IDENTIFICATION_STATUS =
SearchEventsIncrementalIdentificationStatus.PARTIALLY_COMPLETED;
final Boolean SIMULATOR = true;
final List<SearchEventsSource> SOURCE = Arrays.asList(SearchEventsSource.EDGE);

Map<String, String> expectedQueryParams = new HashMap<>();
expectedQueryParams.put("limit", String.valueOf(LIMIT));
Expand Down Expand Up @@ -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",
Expand All @@ -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);
Expand Down Expand Up @@ -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<Event> events = response.getEvents();
assertEquals(events.size(), 1);
}
Expand Down
Loading