|
43 | 43 | import static org.junit.Assert.assertNotNull; |
44 | 44 | import static org.junit.Assert.assertNull; |
45 | 45 | import static org.junit.Assert.assertTrue; |
| 46 | +import static org.junit.Assert.fail; |
46 | 47 | import static org.mockito.ArgumentMatchers.any; |
47 | 48 | import static org.mockito.Mockito.mock; |
48 | 49 | import static org.mockito.Mockito.when; |
@@ -96,8 +97,8 @@ public void TestAuthoriseError010Mocked() throws Exception { |
96 | 97 | PaymentRequest paymentRequest = createFullCardPaymentRequest(); |
97 | 98 |
|
98 | 99 | try { |
99 | | - PaymentResult paymentResult = payment.authorise(paymentRequest); |
100 | | - assertTrue("Exception expected", false); |
| 100 | + payment.authorise(paymentRequest); |
| 101 | + fail("Exception expected"); |
101 | 102 | } catch (ApiException e) { |
102 | 103 | String errorCode = e.getError().getErrorCode(); |
103 | 104 | assertEquals("010", errorCode); |
@@ -211,18 +212,17 @@ public void TestError401Mocked() throws Exception { |
211 | 212 | PaymentRequest paymentRequest = createFullCardPaymentRequest(); |
212 | 213 |
|
213 | 214 | try { |
214 | | - PaymentResult paymentResult = payment.authorise(paymentRequest); |
215 | | - assertTrue("Exception expected", false); |
| 215 | + payment.authorise(paymentRequest); |
| 216 | + fail("Exception expected"); |
216 | 217 | } catch (ApiException e) { |
| 218 | + assertTrue(e.toString().contains("401")); |
217 | 219 | assertEquals(401, e.getStatusCode()); |
218 | 220 | assertNull(e.getError()); |
219 | 221 | } |
220 | 222 | } |
221 | 223 |
|
222 | 224 | /** |
223 | 225 | * Test OpenInvoice API flow for klarna |
224 | | - * |
225 | | - * @throws Exception |
226 | 226 | */ |
227 | 227 | @Test |
228 | 228 | public void TestOpenInvoice() throws Exception { |
|
0 commit comments