@@ -57,41 +57,41 @@ public class WebServiceClientTest {
5757
5858 @ Test
5959 public void testReportTransaction () throws Exception {
60- String responseContent = "" ;
61- WebServiceClient client = createSuccessClient ("transactions/report" , 204 ,
60+ var responseContent = "" ;
61+ var client = createSuccessClient ("transactions/report" , 204 ,
6262 responseContent );
63- TransactionReport request = fullTransactionReport ();
63+ var request = fullTransactionReport ();
6464 client .reportTransaction (request );
6565 }
6666
6767 @ Test
6868 public void testFullScoreTransaction () throws Exception {
69- String responseContent = readJsonFile ("score-response" );
70- WebServiceClient client = createSuccessClient ("score" , 200 , responseContent );
71- Transaction request = fullTransaction ();
72- ScoreResponse response = client .score (request );
69+ var responseContent = readJsonFile ("score-response" );
70+ var client = createSuccessClient ("score" , 200 , responseContent );
71+ var request = fullTransaction ();
72+ var response = client .score (request );
7373
7474 JSONAssert .assertEquals (responseContent , response .toJson (), true );
7575 verifyRequestFor (wireMock , "score" , "full-request" );
7676 }
7777
7878 @ Test
7979 public void testFullScoreTransactionWithEmailMd5 () throws Exception {
80- String responseContent = readJsonFile ("score-response" );
81- WebServiceClient client = createSuccessClient ("score" , 200 , responseContent );
82- Transaction request = fullTransactionEmailMd5 ();
83- ScoreResponse response = client .score (request );
80+ var responseContent = readJsonFile ("score-response" );
81+ var client = createSuccessClient ("score" , 200 , responseContent );
82+ var request = fullTransactionEmailMd5 ();
83+ var response = client .score (request );
8484
8585 JSONAssert .assertEquals (responseContent , response .toJson (), true );
8686 verifyRequestFor (wireMock , "score" , "full-request-email-md5" );
8787 }
8888
8989 @ Test
9090 public void testFullInsightsTransaction () throws Exception {
91- String responseContent = readJsonFile ("insights-response" );
92- WebServiceClient client = createSuccessClient ("insights" , 200 , responseContent );
93- Transaction request = fullTransaction ();
94- InsightsResponse response = client .insights (request );
91+ var responseContent = readJsonFile ("insights-response" );
92+ var client = createSuccessClient ("insights" , 200 , responseContent );
93+ var request = fullTransaction ();
94+ var response = client .insights (request );
9595
9696 // We use non-strict checking as there is some extra stuff in the serialized
9797 // object, most notably the "name" field in the GeoIP2 InsightsResponse subobjects.
@@ -118,7 +118,7 @@ public void testFullInsightsTransaction() throws Exception {
118118
119119 assertTrue (response .getCreditCard ().isVirtual ());
120120
121- List < IpRiskReason > reasons = response .getIpAddress ().getRiskReasons ();
121+ var reasons = response .getIpAddress ().getRiskReasons ();
122122
123123 assertEquals (2 , reasons .size (), "two IP risk reasons" );
124124 assertEquals (
@@ -130,10 +130,10 @@ public void testFullInsightsTransaction() throws Exception {
130130
131131 @ Test
132132 public void testFullFactorsTransaction () throws Exception {
133- String responseContent = readJsonFile ("factors-response" );
134- WebServiceClient client = createSuccessClient ("factors" , 200 , responseContent );
135- Transaction request = fullTransaction ();
136- FactorsResponse response = client .factors (request );
133+ var responseContent = readJsonFile ("factors-response" );
134+ var client = createSuccessClient ("factors" , 200 , responseContent );
135+ var request = fullTransaction ();
136+ var response = client .factors (request );
137137
138138 // We use non-strict checking as there is some extra stuff in the serialized
139139 // object, most notably the "name" field in the GeoIP2 InsightsResponse subobjects.
@@ -161,8 +161,8 @@ public void testFullFactorsTransaction() throws Exception {
161161
162162 @ Test
163163 public void testRequestEncoding () throws Exception {
164- WebServiceClient client = createSuccessClient ("insights" , 200 , "{}" );
165- Transaction request = new Transaction .Builder (
164+ var client = createSuccessClient ("insights" , 200 , "{}" );
165+ var request = new Transaction .Builder (
166166 new Device .Builder (InetAddress .getByName ("1.1.1.1" )).build ()
167167 ).shipping (
168168 new Shipping .Builder ()
@@ -178,28 +178,28 @@ public void testRequestEncoding() throws Exception {
178178
179179 @ Test
180180 public void test200WithNoBody () throws Exception {
181- WebServiceClient client = createSuccessClient ("insights" , 200 , "" );
182- Transaction request = fullTransaction ();
183- Exception ex = assertThrows (MinFraudException .class , () -> client .insights (request ));
181+ var client = createSuccessClient ("insights" , 200 , "" );
182+ var request = fullTransaction ();
183+ var ex = assertThrows (MinFraudException .class , () -> client .insights (request ));
184184
185185 assertThat (ex .getMessage (),
186186 matchesPattern ("Received a 200 response but could not decode it as JSON" ));
187187 }
188188
189189 @ Test
190190 public void test200WithInvalidJson () throws Exception {
191- WebServiceClient client = createSuccessClient ("insights" , 200 , "{" );
192- Transaction request = fullTransaction ();
191+ var client = createSuccessClient ("insights" , 200 , "{" );
192+ var request = fullTransaction ();
193193
194- Exception ex = assertThrows (MinFraudException .class , () -> client .insights (request ));
194+ var ex = assertThrows (MinFraudException .class , () -> client .insights (request ));
195195
196196 assertEquals ("Received a 200 response but could not decode it as JSON" ,
197197 ex .getMessage ());
198198 }
199199
200200 @ Test
201201 public void testInsufficientCredit () {
202- Exception ex = assertThrows (InsufficientFundsException .class , () -> createInsightsError (
202+ var ex = assertThrows (InsufficientFundsException .class , () -> createInsightsError (
203203 402 ,
204204 "application/json" ,
205205 "{\" code\" :\" INSUFFICIENT_FUNDS\" ,\" error\" :\" out of credit\" }"
@@ -214,7 +214,7 @@ public void testInsufficientCredit() {
214214 "LICENSE_KEY_REQUIRED" ,
215215 "USER_ID_REQUIRED" })
216216 public void testInvalidAuth (String code ) {
217- Exception ex = assertThrows (AuthenticationException .class , () ->
217+ var ex = assertThrows (AuthenticationException .class , () ->
218218 createInsightsError (
219219 401 ,
220220 "application/json" ,
@@ -226,7 +226,7 @@ public void testInvalidAuth(String code) {
226226
227227 @ Test
228228 public void testPermissionRequired () {
229- Exception ex = assertThrows (PermissionRequiredException .class , () -> createInsightsError (
229+ var ex = assertThrows (PermissionRequiredException .class , () -> createInsightsError (
230230 403 ,
231231 "application/json" ,
232232 "{\" code\" :\" PERMISSION_REQUIRED\" ,\" error\" :\" Permission required\" }"
@@ -236,7 +236,7 @@ public void testPermissionRequired() {
236236
237237 @ Test
238238 public void testInvalidRequest () {
239- Exception ex = assertThrows (InvalidRequestException .class , () ->
239+ var ex = assertThrows (InvalidRequestException .class , () ->
240240 createInsightsError (
241241 400 ,
242242 "application/json" ,
@@ -248,7 +248,7 @@ public void testInvalidRequest() {
248248
249249 @ Test
250250 public void test400WithInvalidJson () {
251- Exception ex = assertThrows (HttpException .class , () ->
251+ var ex = assertThrows (HttpException .class , () ->
252252 createInsightsError (
253253 400 ,
254254 "application/json" ,
@@ -261,7 +261,7 @@ public void test400WithInvalidJson() {
261261
262262 @ Test
263263 public void test400WithNoBody () {
264- Exception ex = assertThrows (HttpException .class , () ->
264+ var ex = assertThrows (HttpException .class , () ->
265265 createInsightsError (
266266 400 ,
267267 "application/json" ,
@@ -274,7 +274,7 @@ public void test400WithNoBody() {
274274
275275 @ Test
276276 public void test400WithUnexpectedContentType () {
277- Exception ex = assertThrows (HttpException .class , () ->
277+ var ex = assertThrows (HttpException .class , () ->
278278 createInsightsError (
279279 400 ,
280280 "text/plain" ,
@@ -288,7 +288,7 @@ public void test400WithUnexpectedContentType() {
288288
289289 @ Test
290290 public void test400WithUnexpectedJson () {
291- Exception ex = assertThrows (HttpException .class , () ->
291+ var ex = assertThrows (HttpException .class , () ->
292292 createInsightsError (
293293 400 ,
294294 "application/json" ,
@@ -302,7 +302,7 @@ public void test400WithUnexpectedJson() {
302302
303303 @ Test
304304 public void test300 () {
305- Exception ex = assertThrows (HttpException .class , () ->
305+ var ex = assertThrows (HttpException .class , () ->
306306 createInsightsError (
307307 300 ,
308308 "application/json" ,
@@ -315,7 +315,7 @@ public void test300() {
315315
316316 @ Test
317317 public void test500 () {
318- Exception ex = assertThrows (HttpException .class , () ->
318+ var ex = assertThrows (HttpException .class , () ->
319319 createInsightsError (
320320 500 ,
321321 "application/json" ,
@@ -363,9 +363,9 @@ private WebServiceClient createClient(String service, int status, String content
363363
364364 @ Test
365365 public void testHttpClientWorks () {
366- HttpClient customClient = HttpClient .newBuilder ().build ();
366+ var customClient = HttpClient .newBuilder ().build ();
367367
368- WebServiceClient client = new WebServiceClient .Builder (6 , "0123456789" )
368+ var client = new WebServiceClient .Builder (6 , "0123456789" )
369369 .httpClient (customClient )
370370 .build ();
371371
@@ -375,9 +375,9 @@ public void testHttpClientWorks() {
375375
376376 @ Test
377377 public void testHttpClientWithConnectTimeoutThrowsException () {
378- HttpClient customClient = HttpClient .newBuilder ().build ();
378+ var customClient = HttpClient .newBuilder ().build ();
379379
380- Exception ex = assertThrows (IllegalArgumentException .class , () ->
380+ var ex = assertThrows (IllegalArgumentException .class , () ->
381381 new WebServiceClient .Builder (6 , "0123456789" )
382382 .httpClient (customClient )
383383 .connectTimeout (Duration .ofSeconds (5 ))
@@ -390,9 +390,9 @@ public void testHttpClientWithConnectTimeoutThrowsException() {
390390
391391 @ Test
392392 public void testHttpClientWithProxyThrowsException () {
393- HttpClient customClient = HttpClient .newBuilder ().build ();
393+ var customClient = HttpClient .newBuilder ().build ();
394394
395- Exception ex = assertThrows (IllegalArgumentException .class , () ->
395+ var ex = assertThrows (IllegalArgumentException .class , () ->
396396 new WebServiceClient .Builder (6 , "0123456789" )
397397 .httpClient (customClient )
398398 .proxy (java .net .ProxySelector .of (null ))
0 commit comments