Skip to content

Commit

Permalink
udpated test case
Browse files Browse the repository at this point in the history
  • Loading branch information
javidlulu committed Jan 18, 2021
1 parent 249c869 commit 5588cfd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/test/java/jp/ne/paypay/api/ApiClientTest.java
Expand Up @@ -190,6 +190,11 @@ public void deserializeTest() throws ApiException {
result = apiClient.deserialize(null, localVarReturnType);
Assert.assertNull(result);

builder.header("content-disposition","filename=test.json");
response=builder.build();
result = apiClient.deserialize(response, localVarReturnType);
Assert.assertNotNull(result);
Assert.assertTrue(result.toString().endsWith(".json"));
}

@Test
Expand Down Expand Up @@ -245,8 +250,12 @@ public void handleResponseTest() throws ApiException, IOException {
builder.body(ResponseBody.create(MediaType.parse("application/json"), json.serialize(notDataResponse)));
response = builder.build();
responseParameters.setResponse(response).setReturnType(localVarReturnType).setApiName("v2_createPayment");
Assert.assertThrows(ApiException.class, ()->apiClient.handleResponse(responseParameters));

try{
apiClient.handleResponse(responseParameters);
}catch(ApiException e){
Assert.assertEquals(e.getResolveUrl(),"https://developer.paypay.ne.jp/develop/resolve?api_name=v2_createPayment&code=UNAUTHORIZED&code_id=802001");
Assert.assertTrue(e.getResponseBody().contains("UNAUTHORIZED"));
}
}

@Test
Expand Down

0 comments on commit 5588cfd

Please sign in to comment.