ServiceResponse { public ServiceClientException getException() { return exception; } ServiceResponse();  ServiceResponse(T data, Map<String, String> headers);  ServiceResponse(ServiceClientException e, Map<String, String> headers); void addData(List<T> data); List<T> getDataList(); Map<String, String> getHeaders(); ServiceClientException getException(); boolean getIsSuccess();  }
@Test public void testGetException() throws Exception { ServiceResponse response = new ServiceResponse(new ServiceClientException("exception", null), new HashMap<String, String>() {{ put("header1", "value1"); }}); assertThat(response.getException(), instanceOf(ServiceClientException.class)); assertThat(response.getException(), instanceOf(PromiseBrokenException.class)); assertEquals(response.getHeaders().get("header1"), "value1"); assertFalse(response.getIsSuccess()); assertTrue(response.getDataList().isEmpty()); }