From 5b2a728ec9c09c07d0b6d9f1df0ce320b6f4ec90 Mon Sep 17 00:00:00 2001 From: Kevin Hellemun Date: Sat, 30 Dec 2017 09:35:25 +0100 Subject: [PATCH] Added test to make sure that the response id field is not null. (bunq/sdk_java#55) --- .../com/bunq/sdk/http/ErrorResponseTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test/java/com/bunq/sdk/http/ErrorResponseTest.java diff --git a/src/test/java/com/bunq/sdk/http/ErrorResponseTest.java b/src/test/java/com/bunq/sdk/http/ErrorResponseTest.java new file mode 100644 index 00000000..36a7be4e --- /dev/null +++ b/src/test/java/com/bunq/sdk/http/ErrorResponseTest.java @@ -0,0 +1,32 @@ +package com.bunq.sdk.http; + +import com.bunq.sdk.BunqSdkTestBase; +import com.bunq.sdk.exception.ApiException; +import com.bunq.sdk.model.generated.endpoint.UserPerson; +import org.junit.Test; + +import static org.junit.Assert.assertNotNull; + +public class ErrorResponseTest extends BunqSdkTestBase { + /** + * Invalid user id to trigger BadRequestException + */ + private static final int INVALID_USER_PERSON_ID = 0; + + /** + */ + @Test + public void badRequestWitResponseIdTest() + { + ApiException caughtException = null; + + try { + UserPerson.get(getApiContext(), INVALID_USER_PERSON_ID); + } catch (ApiException $exception) { + caughtException = $exception; + } + + assertNotNull(caughtException); + assertNotNull(caughtException.getResponseId()); + } +}