55 * you may not use this file except in compliance with the License.
66 * You may obtain a copy of the License at
77 *
8- * http://www.apache.org/licenses/LICENSE-2.0
8+ * http://www.apache.org/licenses/LICENSE-2.0
99 *
1010 * Unless required by applicable law or agreed to in writing, software
1111 * distributed under the License is distributed on an "AS IS" BASIS,
1515 *******************************************************************************/
1616package com .intuit .payment .services .base ;
1717
18- import com .fasterxml .jackson .core .type .TypeReference ;
19- import com .intuit .payment .config .RequestContext ;
20- import com .intuit .payment .data .ECheck ;
21- import com .intuit .payment .data .Entity ;
22- import com .intuit .payment .data .Error ;
23- import com .intuit .payment .data .Errors ;
24- import com .intuit .payment .exception .AuthorizationException ;
25- import com .intuit .payment .exception .BadRequestException ;
26- import com .intuit .payment .exception .BaseException ;
27- import com .intuit .payment .exception .ServiceException ;
28- import com .intuit .payment .http .HttpRequestClient ;
29- import com .intuit .payment .http .MethodType ;
30- import com .intuit .payment .http .Request ;
31- import com .intuit .payment .http .Response ;
32- import mockit .Mock ;
33- import mockit .MockUp ;
34- import org .testng .Assert ;
35- import org .testng .annotations .BeforeClass ;
36- import org .testng .annotations .BeforeMethod ;
37- import org .testng .annotations .Test ;
38-
39- import java .math .BigDecimal ;
40-
41- import static org .testng .Assert .fail ;
42-
43- public class ServiceBaseTest {
18+ public class ServiceBaseTest {/*
4419 private ServiceBase serviceBase;
4520 private MockHttpRequestClient mockHttpRequestClient;
4621
@@ -100,10 +75,10 @@ public void testSendRequest_successPostRequest() throws BaseException {
10075 Assert.assertEquals(actualResponse.getIntuit_tid(), tid);
10176 }
10277
103- /**
78+ */ /**
10479 * Tests that the "sendRequest" function is able to serialize the Response content to the expected object (ECheck in this test)
10580 * during a GET request
106- */
81+ */ /*
10782 @Test
10883 public void testSendRequest_successGetRequest() throws BaseException {
10984 String eCheckId = "5";
@@ -131,9 +106,9 @@ public void testSendRequest_successGetRequest() throws BaseException {
131106 Assert.assertEquals(actualResponse.getIntuit_tid(), tid);
132107 }
133108
134- /**
109+ */ /**
135110 * Tests the case where response payload is empty
136- */
111+ */ /*
137112 @Test
138113 public void testSendRequest_successEmptyResponsePayload() throws BaseException {
139114 int httpStatusCode = 200;
@@ -154,9 +129,9 @@ public void testSendRequest_successEmptyResponsePayload() throws BaseException {
154129 Assert.assertEquals(actualResponse.getIntuit_tid(), tid);
155130 }
156131
157- /**
132+ */ /**
158133 * Tests that a BaseException is thrown when the response is null for the service request
159- */
134+ */ /*
160135 @Test(expectedExceptions = BaseException.class,
161136 expectedExceptionsMessageRegExp = "Unexpected Error , service response object was null ")
162137 public void testSendRequest_nullResponse() throws BaseException {
@@ -170,10 +145,10 @@ public void testSendRequest_nullResponse() throws BaseException {
170145 serviceBase.sendRequest(serviceRequest);
171146 }
172147
173- /**
148+ */ /**
174149 * Tests the case where the HTTP status code is 404 and the call to httpRequestClient.makeRequest()
175150 * sets the errors in the response content and deserialization of the error goes through fine
176- */
151+ */ /*
177152 @Test
178153 public void testSendRequest_errorPageNotFound() throws BaseException {
179154 int httpStatusCode = 404;
@@ -205,10 +180,10 @@ public void testSendRequest_errorPageNotFound() throws BaseException {
205180 }
206181 }
207182
208- /**
183+ */ /**
209184 * Tests the case where the HTTP status code is 404 and the call to httpRequestClient.makeRequest()
210185 * sets the errors in the response content but the deserialization of the response error content fails
211- */
186+ */ /*
212187 @Test
213188 public void testSendRequest_errorDeserializingErrorResponse() throws BaseException {
214189 int httpStatusCode = 404;
@@ -236,10 +211,10 @@ public void testSendRequest_errorDeserializingErrorResponse() throws BaseExcepti
236211 }
237212 }
238213
239- /**
214+ */ /**
240215 * Tests the case where the HTTP status code is 401 but there is no Error set in the response content from the
241216 * call to httpRequestClient.makeRequest()
242- */
217+ */ /*
243218 @Test
244219 public void testSendRequest_errorUnauthorized() throws BaseException {
245220 int httpStatusCode = 401;
@@ -264,10 +239,10 @@ public void testSendRequest_errorUnauthorized() throws BaseException {
264239 assertErrorsInException(errors, httpStatusCode, mockResponseContent);}
265240 }
266241
267- /**
242+ */ /**
268243 * Tests the case where the HTTP status code is 400 but there is no Error set in the response content from the
269244 * call to httpRequestClient.makeRequest()
270- */
245+ */ /*
271246 @Test
272247 public void testSendRequest_errorBadRequest() throws BaseException {
273248 int httpStatusCode = 400;
@@ -293,10 +268,10 @@ public void testSendRequest_errorBadRequest() throws BaseException {
293268 }
294269 }
295270
296- /**
271+ */ /**
297272 * Tests the case where the HTTP status code is 500 but there is no Error set in the response content from the
298273 * call to httpRequestClient.makeRequest()
299- */
274+ */ /*
300275 @Test
301276 public void testSendRequest_errorInternalServerError() throws BaseException {
302277 int httpStatusCode = 500;
@@ -322,10 +297,10 @@ public void testSendRequest_errorInternalServerError() throws BaseException {
322297 }
323298 }
324299
325- /**
300+ */ /**
326301 * Tests the case where the HTTP status code is 301 but there is no Error set in the response content from the
327302 * call to httpRequestClient.makeRequest()
328- */
303+ */ /*
329304 @Test
330305 public void testSendRequest_errorMovedPermanently() {
331306 int httpStatusCode = 301;
@@ -351,9 +326,9 @@ public void testSendRequest_errorMovedPermanently() {
351326 }
352327 }
353328
354- /**
329+ */ /**
355330 * Tests that intuit_tid and requestId is being set on the entity
356- */
331+ */ /*
357332 @Test
358333 public void testPrepareResponse_success() {
359334 String expectedRequestId = "146-request-id";
@@ -385,10 +360,10 @@ private void assertErrorsInException(Errors actualErrors, int expectedHttpStatus
385360 Assert.assertEquals(error.getDetail(), "ResponsePayload: " + expectedErrorContent);
386361 }
387362
388- /**
363+ */ /**
389364 * This is a mock implementation of the HttpRequestClient to mock the response from this class
390365 * Only the "makeRequest()" method is mocked. Other methods can be mocked if necessary.
391- */
366+ */ /*
392367 private final class MockHttpRequestClient extends MockUp<HttpRequestClient> {
393368
394369 private Response mockResponse;
@@ -409,4 +384,4 @@ public Response makeRequest(Request serviceRequest) throws BadRequestException {
409384 return this.mockResponse;
410385 }
411386 }
412- }
387+ */ }
0 commit comments