|
6 | 6 | import static org.junit.jupiter.api.Assertions.assertTrue; |
7 | 7 |
|
8 | 8 | import com.fasterxml.jackson.jr.ob.JSON; |
| 9 | +import com.maxmind.geoip2.record.AnonymizerFeed; |
9 | 10 | import java.time.LocalDate; |
10 | 11 | import java.util.UUID; |
11 | 12 | import org.junit.jupiter.api.Test; |
@@ -39,6 +40,11 @@ public void testInsights() throws Exception { |
39 | 40 | .put("is_tor_exit_node", true) |
40 | 41 | .put("network_last_seen", "2025-01-15") |
41 | 42 | .put("provider_name", "TestVPN") |
| 43 | + .startObjectField("residential") |
| 44 | + .put("confidence", 82) |
| 45 | + .put("network_last_seen", "2026-05-11") |
| 46 | + .put("provider_name", "quickshift") |
| 47 | + .end() |
42 | 48 | .end() |
43 | 49 | .startObjectField("country") |
44 | 50 | .put("iso_code", "US") |
@@ -152,5 +158,24 @@ public void testInsights() throws Exception { |
152 | 158 | "correct networkLastSeen" |
153 | 159 | ); |
154 | 160 | assertEquals("TestVPN", insights.ipAddress().anonymizer().providerName(), "correct providerName"); |
| 161 | + |
| 162 | + AnonymizerFeed residential = insights.ipAddress().anonymizer().residential(); |
| 163 | + |
| 164 | + assertNotNull(residential, "anonymizer.residential() returns null"); |
| 165 | + assertEquals( |
| 166 | + Integer.valueOf(82), |
| 167 | + residential.confidence(), |
| 168 | + "correct anonymizer.residential().confidence()" |
| 169 | + ); |
| 170 | + assertEquals( |
| 171 | + LocalDate.parse("2026-05-11"), |
| 172 | + residential.networkLastSeen(), |
| 173 | + "correct anonymizer.residential().networkLastSeen()" |
| 174 | + ); |
| 175 | + assertEquals( |
| 176 | + "quickshift", |
| 177 | + residential.providerName(), |
| 178 | + "correct anonymizer.residential().providerName()" |
| 179 | + ); |
155 | 180 | } |
156 | 181 | } |
0 commit comments