From 416fff7ecd3b439d0ee53b905a3b831f6f4b8469 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Jul 2026 15:54:51 +0000 Subject: [PATCH 1/2] test: cover source param and unknown-field event deserialization --- .../v4/api/FingerprintApiTest.java | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) 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..cbefab78 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,46 @@ 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()); + + assertFalse(response.getClonedApp()); + assertFalse(response.getEmulator()); + assertFalse(response.getFrida()); + assertFalse(response.getJailbroken()); + assertFalse(response.getIpBlocklist().getEmailSpam()); + assertFalse(response.getIpBlocklist().getTorNode()); + assertTrue(response.getProxy()); + assertEquals(ProxyDetails.ProxyTypeEnum.RESIDENTIAL, response.getProxyDetails().getProxyType()); + assertEquals(1708102555327L, response.getProxyDetails().getLastSeenAt()); + assertFalse(response.getTampering()); + assertFalse(response.getVpn()); + assertFalse(response.getVirtualMachine()); + assertInstanceOf(VelocityData.class, response.getVelocity().getDistinctCountry()); + assertFalse(response.getLocationSpoofing()); + assertEquals(0L, response.getFactoryResetTimestamp()); + assertNotNull(response.getTags()); + assertTrue(response.getTags().isEmpty()); + } + @Test public void updateEventLinkedIdRequest() throws ApiException { final String LINKED_ID = "myLinkedId"; @@ -482,6 +522,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 +575,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 +595,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 +651,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); } From 99d6cb2c955d5548201b75fd7fdb6618a637aaa1 Mon Sep 17 00:00:00 2001 From: Dan McNulty Date: Wed, 1 Jul 2026 11:06:17 -0500 Subject: [PATCH 2/2] chore: simplify assertions in `getEventWithUnknownFieldTest` - Remove unnecessary assertions in `getEventWithUnknownFieldTest`. The test is confirming that an unknown field doesn't trigger unexpected errors in deserialization. --- .../fingerprint/v4/api/FingerprintApiTest.java | 18 ------------------ 1 file changed, 18 deletions(-) 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 cbefab78..0a2f1f3b 100644 --- a/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java +++ b/sdk/src/test/java/com/fingerprint/v4/api/FingerprintApiTest.java @@ -243,24 +243,6 @@ public void getEventWithUnknownFieldTest() throws ApiException { assertNotNull(response); assertNotNull(response.getIdentification()); assertEquals("Ibk1527CUFmcnjLwIs4A9", response.getIdentification().getVisitorId()); - - assertFalse(response.getClonedApp()); - assertFalse(response.getEmulator()); - assertFalse(response.getFrida()); - assertFalse(response.getJailbroken()); - assertFalse(response.getIpBlocklist().getEmailSpam()); - assertFalse(response.getIpBlocklist().getTorNode()); - assertTrue(response.getProxy()); - assertEquals(ProxyDetails.ProxyTypeEnum.RESIDENTIAL, response.getProxyDetails().getProxyType()); - assertEquals(1708102555327L, response.getProxyDetails().getLastSeenAt()); - assertFalse(response.getTampering()); - assertFalse(response.getVpn()); - assertFalse(response.getVirtualMachine()); - assertInstanceOf(VelocityData.class, response.getVelocity().getDistinctCountry()); - assertFalse(response.getLocationSpoofing()); - assertEquals(0L, response.getFactoryResetTimestamp()); - assertNotNull(response.getTags()); - assertTrue(response.getTags().isEmpty()); } @Test