Skip to content

Commit 0fc6ffd

Browse files
amatiushkinamatiushkin
authored andcommitted
Add test for partial and no response test (#75) cases (#60)
1 parent 92bc782 commit 0fc6ffd

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

ipp-v3-java-devkit/src/test/java/com/intuit/ipp/interceptors/CallbackHandlerInterceptorCDCTest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ public void singleEntityIsOk() throws FMSException {
5353
}
5454

5555

56+
/**
57+
* Illustrates https://github.com/intuit/QuickBooks-V3-Java-SDK/issues/75
58+
* Error is expected in result, but it gives empty result.
59+
*
60+
* @throws FMSException
61+
*/
62+
@Test
63+
public void errorNoResponse() throws FMSException {
64+
final CDCResponse o = new CDCResponse();
65+
final Fault fault = new Fault();
66+
final Error error = new Error();
67+
fault.setError(Collections.singletonList(error));
68+
error.setDetail("My custom error");
69+
o.setFault(fault);
70+
o.setQueryResponse(null);
71+
72+
assertEmptyResult(invokeCDC(Collections.singletonList(o)));
73+
}
74+
5675
@Test
5776
public void error() throws FMSException {
5877
final CDCResponse o = new CDCResponse();
@@ -69,6 +88,23 @@ public void error() throws FMSException {
6988

7089
}
7190

91+
@Test
92+
public void partialError() throws FMSException {
93+
final CDCResponse o = new CDCResponse();
94+
final QueryResponse queryResponse = new QueryResponse();
95+
final Fault fault = new Fault();
96+
final Error error = new Error();
97+
fault.setError(Collections.singletonList(error));
98+
error.setDetail("My custom error");
99+
queryResponse.setFault(fault);
100+
queryResponse.setIntuitObject(Collections.<JAXBElement<? extends IntuitEntity>>singletonList(getDummyTestEntity()));
101+
102+
o.setQueryResponse(Collections.singletonList(queryResponse));
103+
new ResultChecker( assertAndGetFirst(invokeCDC(Collections.singletonList(o))))
104+
.assertErrorsDetails("My custom error")
105+
.assertQueryKeys("IntuitTestEntity");
106+
}
107+
72108

73109
/**
74110
* Asserts that query result contains exactly one response without any fields set

0 commit comments

Comments
 (0)