Skip to content

Commit a39c908

Browse files
oschwaldclaude
andcommitted
Use record-style accessors in tests
Update all test files to use record-style accessor methods (without the 'get' prefix) instead of the deprecated getter methods. This eliminates deprecation warnings and follows the new record-based API patterns introduced in version 4.0.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0409a37 commit a39c908

18 files changed

+112
-112
lines changed

src/test/java/com/maxmind/minfraud/WebServiceClientTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,31 +99,31 @@ public void testFullInsightsTransaction() throws Exception {
9999
JSONAssert.assertEquals(responseContent, response.toJson(), false);
100100
verifyRequestFor(wireMock, "insights", "full-request");
101101
assertTrue(
102-
response.getIpAddress().getCountry().isInEuropeanUnion(),
103-
"response.getIpAddress().getCountry().isInEuropeanUnion() does not return true"
102+
response.ipAddress().country().isInEuropeanUnion(),
103+
"response.ipAddress().country().isInEuropeanUnion() does not return true"
104104
);
105105
assertFalse(
106-
response.getIpAddress().getRegisteredCountry().isInEuropeanUnion(),
107-
"response.getIpAddress().getRegisteredCountry().isInEuropeanUnion() does not return false"
106+
response.ipAddress().registeredCountry().isInEuropeanUnion(),
107+
"response.ipAddress().registeredCountry().isInEuropeanUnion() does not return false"
108108
);
109109
assertTrue(
110-
response.getIpAddress().getRepresentedCountry().isInEuropeanUnion(),
111-
"response.getIpAddress().getRepresentedCountry().isInEuropeanUnion() does not return true"
110+
response.ipAddress().representedCountry().isInEuropeanUnion(),
111+
"response.ipAddress().representedCountry().isInEuropeanUnion() does not return true"
112112
);
113-
assertEquals("2018-04-05T15:34:40-07:00", response.getDevice().getLocalTime());
113+
assertEquals("2018-04-05T15:34:40-07:00", response.device().localTime());
114114

115-
assertEquals("152.216.7.110", response.getIpAddress().getTraits().getIpAddress());
115+
assertEquals("152.216.7.110", response.ipAddress().traits().ipAddress().getHostAddress());
116116
assertEquals("81.2.69.0/24",
117-
response.getIpAddress().getTraits().getNetwork().toString());
117+
response.ipAddress().traits().network().toString());
118118

119-
assertTrue(response.getCreditCard().isVirtual());
119+
assertTrue(response.creditCard().isVirtual());
120120

121-
var reasons = response.getIpAddress().getRiskReasons();
121+
var reasons = response.ipAddress().riskReasons();
122122

123123
assertEquals(2, reasons.size(), "two IP risk reasons");
124124
assertEquals(
125125
"MINFRAUD_NETWORK_ACTIVITY",
126-
reasons.get(1).getCode(),
126+
reasons.get(1).code(),
127127
"second IP risk reason code"
128128
);
129129
}
@@ -141,22 +141,22 @@ public void testFullFactorsTransaction() throws Exception {
141141
JSONAssert.assertEquals(responseContent, response.toJson(), false);
142142
verifyRequestFor(wireMock, "factors", "full-request");
143143
assertTrue(
144-
response.getIpAddress().getCountry().isInEuropeanUnion(),
145-
"response.getIpAddress().getCountry().isInEuropeanUnion() does not return true"
144+
response.ipAddress().country().isInEuropeanUnion(),
145+
"response.ipAddress().country().isInEuropeanUnion() does not return true"
146146
);
147147
assertTrue(
148-
response.getIpAddress().getRegisteredCountry().isInEuropeanUnion(),
149-
"response.getIpAddress().getRegisteredCountry().isInEuropeanUnion() does not return true"
148+
response.ipAddress().registeredCountry().isInEuropeanUnion(),
149+
"response.ipAddress().registeredCountry().isInEuropeanUnion() does not return true"
150150
);
151151
assertFalse(
152-
response.getIpAddress().getRepresentedCountry().isInEuropeanUnion(),
153-
"response.getIpAddress().getRepresentedCountry().isInEuropeanUnion() does not return false"
152+
response.ipAddress().representedCountry().isInEuropeanUnion(),
153+
"response.ipAddress().representedCountry().isInEuropeanUnion() does not return false"
154154
);
155155

156156

157-
assertEquals("152.216.7.110", response.getIpAddress().getTraits().getIpAddress());
157+
assertEquals("152.216.7.110", response.ipAddress().traits().ipAddress().getHostAddress());
158158
assertEquals("81.2.69.0/24",
159-
response.getIpAddress().getTraits().getNetwork().toString());
159+
response.ipAddress().traits().network().toString());
160160
}
161161

162162
@Test

src/test/java/com/maxmind/minfraud/response/BillingAddressTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ public void testBillingAddress() throws Exception {
2828
assertTrue(address.isPostalInCity(), "correct isPostalInCity");
2929
assertEquals(
3030
100,
31-
address.getDistanceToIpLocation().longValue(),
32-
"correct getDistanceToIpLocation"
31+
address.distanceToIpLocation().longValue(),
32+
"correct distanceToIpLocation"
3333
);
3434
assertEquals(
3535
32.1,
36-
address.getLongitude(),
36+
address.longitude(),
3737
DELTA,
3838
"correct longitude"
3939
);
4040
assertEquals(
4141
43.1,
42-
address.getLatitude(),
42+
address.latitude(),
4343
DELTA,
4444
"correct latitude"
4545
);

src/test/java/com/maxmind/minfraud/response/CreditCardTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public void testCreditCard() throws Exception {
2929
.finish()
3030
);
3131

32-
assertEquals("Bank", cc.getIssuer().getName());
33-
assertEquals("US", cc.getCountry());
34-
assertEquals("Visa", cc.getBrand());
35-
assertEquals("credit", cc.getType());
32+
assertEquals("Bank", cc.issuer().name());
33+
assertEquals("US", cc.country());
34+
assertEquals("Visa", cc.brand());
35+
assertEquals("credit", cc.type());
3636
assertTrue(cc.isBusiness());
3737
assertTrue(cc.isPrepaid());
3838
assertTrue(cc.isVirtual());

src/test/java/com/maxmind/minfraud/response/DeviceTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public void testDevice() throws Exception {
2323
.finish()
2424
);
2525

26-
assertEquals(99.0, device.getConfidence(), 1e-15);
27-
assertEquals(UUID.fromString("C8D3BE1A-BE26-11E5-8C50-1B575C37265F"), device.getId());
28-
assertEquals("2016-06-08T14:16:38Z", device.getLastSeen());
26+
assertEquals(99.0, device.confidence(), 1e-15);
27+
assertEquals(UUID.fromString("C8D3BE1A-BE26-11E5-8C50-1B575C37265F"), device.id());
28+
assertEquals("2016-06-08T14:16:38Z", device.lastSeen());
2929
assertEquals("2016-06-08T14:16:38Z", device.getLastSeenDateTime().toString());
30-
assertEquals("2018-04-05T15:21:01-07:00", device.getLocalTime());
30+
assertEquals("2018-04-05T15:21:01-07:00", device.localTime());
3131
assertEquals("2018-04-05T15:21:01-07:00", device.getLocalDateTime().toString());
3232

3333
}

src/test/java/com/maxmind/minfraud/response/DispositionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public void testDisposition() throws Exception {
2121
.finish()
2222
);
2323

24-
assertEquals("accept", disposition.getAction());
25-
assertEquals("default", disposition.getReason());
26-
assertEquals("the label", disposition.getRuleLabel());
24+
assertEquals("accept", disposition.action());
25+
assertEquals("default", disposition.reason());
26+
assertEquals("the label", disposition.ruleLabel());
2727
}
2828
}

src/test/java/com/maxmind/minfraud/response/EmailDomainTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public void testEmailDomain() throws Exception {
2020
.finish()
2121
);
2222

23-
assertEquals(LocalDate.parse("2014-02-03"), domain.getFirstSeen());
23+
assertEquals(LocalDate.parse("2014-02-03"), domain.firstSeen());
2424
}
2525
}

src/test/java/com/maxmind/minfraud/response/EmailTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public void testEmail() throws Exception {
3030
.finish()
3131
);
3232

33-
assertEquals(LocalDate.parse("2014-02-03"), email.getDomain().getFirstSeen());
33+
assertEquals(LocalDate.parse("2014-02-03"), email.domain().firstSeen());
3434
assertFalse(email.isDisposable());
3535
assertFalse(email.isFree());
3636
assertTrue(email.isHighRisk());
37-
assertEquals("2017-01-02", email.getFirstSeen());
37+
assertEquals("2017-01-02", email.firstSeen());
3838
assertEquals(LocalDate.parse("2017-01-02"), email.getFirstSeenDate());
3939
}
4040

@@ -51,11 +51,11 @@ public void testEmailWithoutFirstSeen() throws Exception {
5151
.finish()
5252
);
5353

54-
assertNotNull(email.getDomain());
54+
assertNotNull(email.domain());
5555
assertNull(email.isDisposable());
5656
assertFalse(email.isFree());
5757
assertTrue(email.isHighRisk());
58-
assertNull(email.getFirstSeen());
58+
assertNull(email.firstSeen());
5959
assertNull(email.getFirstSeenDate());
6060
}
6161
}

src/test/java/com/maxmind/minfraud/response/FactorsResponseTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,42 @@ public void testFactors() throws Exception {
4545
.finish()
4646
);
4747

48-
assertTrue(factors.getShippingPhone().isVoip(), "correct shipping phone isVoip");
49-
assertFalse(factors.getShippingPhone().matchesPostal(), "correct shipping phone matchesPostal");
50-
assertFalse(factors.getBillingPhone().isVoip(), "correct billing phone isVoip");
51-
assertTrue(factors.getBillingPhone().matchesPostal(), "correct billing phone matchesPostal");
48+
assertTrue(factors.shippingPhone().isVoip(), "correct shipping phone isVoip");
49+
assertFalse(factors.shippingPhone().matchesPostal(), "correct shipping phone matchesPostal");
50+
assertFalse(factors.billingPhone().isVoip(), "correct billing phone isVoip");
51+
assertTrue(factors.billingPhone().matchesPostal(), "correct billing phone matchesPostal");
5252

5353
assertEquals(
5454
Double.valueOf(1.20),
55-
factors.getFundsRemaining(),
55+
factors.fundsRemaining(),
5656
"correct funnds remaining"
5757
);
58-
assertEquals(UUID.fromString(id), factors.getId(), "correct ID");
58+
assertEquals(UUID.fromString(id), factors.id(), "correct ID");
5959
assertEquals(
6060
Integer.valueOf(123),
61-
factors.getQueriesRemaining(),
61+
factors.queriesRemaining(),
6262
"correct queries remaining"
6363
);
6464
assertEquals(
6565
Double.valueOf(0.01),
66-
factors.getRiskScore(),
66+
factors.riskScore(),
6767
"correct risk score"
6868
);
69-
assertEquals(1, factors.getRiskScoreReasons().size());
69+
assertEquals(1, factors.riskScoreReasons().size());
7070
assertEquals(
7171
Double.valueOf(45),
72-
factors.getRiskScoreReasons().get(0).getMultiplier(),
72+
factors.riskScoreReasons().get(0).multiplier(),
7373
"risk multiplier"
7474
);
75-
assertEquals(1, factors.getRiskScoreReasons().get(0).getReasons().size());
75+
assertEquals(1, factors.riskScoreReasons().get(0).reasons().size());
7676
assertEquals(
7777
"ANONYMOUS_IP",
78-
factors.getRiskScoreReasons().get(0).getReasons().get(0).getCode(),
78+
factors.riskScoreReasons().get(0).reasons().get(0).code(),
7979
"risk reason code"
8080
);
8181
assertEquals(
8282
"Risk due to IP being an Anonymous IP",
83-
factors.getRiskScoreReasons().get(0).getReasons().get(0).getReason(),
83+
factors.riskScoreReasons().get(0).reasons().get(0).reason(),
8484
"risk reason"
8585
);
8686
}

src/test/java/com/maxmind/minfraud/response/GeoIp2LocationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void testGetLocalTime() throws Exception {
2020
.finish()
2121
);
2222

23-
assertEquals(time, location.getLocalTime());
23+
assertEquals(time, location.localTime());
2424
assertEquals(time, location.getLocalDateTime().toString());
2525
}
2626
}

src/test/java/com/maxmind/minfraud/response/InsightsResponseTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,58 +67,58 @@ public void testInsights() throws Exception {
6767
.finish()
6868
);
6969

70-
assertEquals("accept", insights.getDisposition().getAction(), "disposition");
70+
assertEquals("accept", insights.disposition().action(), "disposition");
7171
assertEquals(
7272
LocalDate.parse("2014-02-03"),
73-
insights.getEmail().getDomain().getFirstSeen(),
73+
insights.email().domain().firstSeen(),
7474
"email domain first seen"
7575
);
7676
assertEquals(
7777
"US",
78-
insights.getIpAddress().getCountry().getIsoCode(),
78+
insights.ipAddress().country().isoCode(),
7979
"correct country ISO"
8080
);
81-
assertTrue(insights.getCreditCard().isBusiness(), "correct credit card is business");
82-
assertTrue(insights.getCreditCard().isPrepaid(), "correct credit card prepaid");
81+
assertTrue(insights.creditCard().isBusiness(), "correct credit card is business");
82+
assertTrue(insights.creditCard().isPrepaid(), "correct credit card prepaid");
8383

8484
assertTrue(
85-
insights.getShippingAddress().isInIpCountry(),
85+
insights.shippingAddress().isInIpCountry(),
8686
"correct shipping address is in IP country"
8787
);
88-
assertTrue(insights.getShippingPhone().isVoip(), "correct shipping phone isVoip");
88+
assertTrue(insights.shippingPhone().isVoip(), "correct shipping phone isVoip");
8989
assertFalse(
90-
insights.getShippingPhone().matchesPostal(),
90+
insights.shippingPhone().matchesPostal(),
9191
"correct shipping phone matchesPostal"
9292
);
9393

9494
assertTrue(
95-
insights.getBillingAddress().isInIpCountry(),
95+
insights.billingAddress().isInIpCountry(),
9696
"correct billing address is in IP country"
9797
);
98-
assertFalse(insights.getBillingPhone().isVoip(), "correct billing phone isVoip");
98+
assertFalse(insights.billingPhone().isVoip(), "correct billing phone isVoip");
9999
assertTrue(
100-
insights.getBillingPhone().matchesPostal(),
100+
insights.billingPhone().matchesPostal(),
101101
"correct billing phone matchesPostal"
102102
);
103103

104104
assertEquals(
105105
Double.valueOf(1.20),
106-
insights.getFundsRemaining(),
106+
insights.fundsRemaining(),
107107
"correct funds remaining"
108108
);
109-
assertEquals(UUID.fromString(id), insights.getId(), "correct ID");
109+
assertEquals(UUID.fromString(id), insights.id(), "correct ID");
110110
assertEquals(
111111
Integer.valueOf(123),
112-
insights.getQueriesRemaining(),
112+
insights.queriesRemaining(),
113113
"correct queries remaining"
114114
);
115-
assertEquals(Double.valueOf(0.01), insights.getRiskScore(), "correct risk score");
115+
assertEquals(Double.valueOf(0.01), insights.riskScore(), "correct risk score");
116116
assertEquals(
117117
"INVALID_INPUT",
118-
insights.getWarnings().get(0).getCode(),
118+
insights.warnings().get(0).code(),
119119
"correct warning code"
120120
);
121-
assertEquals("152.216.7.110", insights.getIpAddress().getTraits().getIpAddress());
122-
assertEquals("81.2.69.0/24", insights.getIpAddress().getTraits().getNetwork().toString());
121+
assertEquals("152.216.7.110", insights.ipAddress().traits().ipAddress().getHostAddress());
122+
assertEquals("81.2.69.0/24", insights.ipAddress().traits().network().toString());
123123
}
124124
}

0 commit comments

Comments
 (0)