private void checkForErrorInDispositionReport(DispositionReport report, String Error, String entityKey) { if (entityKey != null && report != null && report.countainsErrorCode(DispositionReport.E_INVALID_KEY_PASSED)) { log.info("entityKey " + entityKey + " was not found in the registry"); } else { if (report == null) { log.info("Missing DispositionReport"); } else { for (Result result : report.getResult()) { log.error(result.getErrInfo().getErrCode() + " " + result.getErrInfo().getValue()); } } } }
public void getNonExitingBusiness() { String nonExistingKey = "nonexistingKey"; try { GetBusinessDetail body = new GetBusinessDetail(); body.getBusinessKey().add(nonExistingKey); BusinessDetail result = inquiry.getBusinessDetail(body); Assert.fail("No business should be found"); System.out.println(result.getBusinessEntity().size()); } catch (Exception e) { try { System.out.println("(Expected) Error message = " + e.getMessage()); DispositionReport report = DispositionReportFaultMessage.getDispositionReport(e); assertNotNull(report); assertTrue(report.countainsErrorCode(DispositionReport.E_INVALID_KEY_PASSED)); } catch (Exception e1) { Assert.fail("We only expect DispositionReportFaultMessage, not " + e1.getClass()); logger.error(e.getMessage(), e1); } } }