DocRetrieveStatusUtil { public static String setResponseStatus(RetrieveDocumentSetResponseType from, RetrieveDocumentSetResponseType to) { String status = null; if (to.getRegistryResponse().getStatus() == null) { status = from.getRegistryResponse().getStatus(); } else if (from.getRegistryResponse().getStatus().equalsIgnoreCase(to.getRegistryResponse().getStatus())) { status = from.getRegistryResponse().getStatus(); } else if (!from.getRegistryResponse().getStatus().equals(to.getRegistryResponse().getStatus())) { status = DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_PARTIALSUCCESS; } return status; }  static String setResponseStatus(RetrieveDocumentSetResponseType from, RetrieveDocumentSetResponseType to); static boolean isStatusSuccess(String status); static boolean isStatusFailureOrPartialFailure(String status);  }
@Test public void setResponseStatusSuccessCase() { DocRetrieveStatusUtil util = new DocRetrieveStatusUtil(); String status = "Success"; String returnedStatus; returnedStatus = util.setResponseStatus(createFromRequestSuccessCase(), createToRequestSucessCase()); assertEquals(returnedStatus, status); }
@Test public void setResponseStatusFailureCase() { DocRetrieveStatusUtil util = new DocRetrieveStatusUtil(); String status = "Failure"; String returnedStatus; returnedStatus = util.setResponseStatus(createFromRequestFailureCase(), createToRequestFailureCase()); assertEquals(returnedStatus, status); }
@Test public void setResponseStatusPartialSuccessCase() { DocRetrieveStatusUtil util = new DocRetrieveStatusUtil(); String status = DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_PARTIALSUCCESS; String returnedStatus; returnedStatus = util.setResponseStatus(createFromRequestSuccessCase(), createToRequestFailureCase()); assertEquals(returnedStatus, status); }