RetrieveDocumentSetResponseTypeDescriptionBuilder extends AssertionEventDescriptionBuilder { @Override public void setReturnValue(Object returnValue) { if (returnValue != null && returnValue instanceof RetrieveDocumentSetResponseType) { response = Optional.of((RetrieveDocumentSetResponseType) returnValue); } else { response = Optional.absent(); } }  @Override void buildTimeStamp(); @Override void buildStatuses(); @Override void buildRespondingHCIDs(); @Override void buildPayloadTypes(); @Override void buildPayloadSizes(); @Override void buildErrorCodes(); @Override void setArguments(Object... arguments); @Override void setReturnValue(Object returnValue);  }
@Test public void basicBuild() { RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); addStatus(response, DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS); addDocumentResponse(response, "homeCommunityId"); RetrieveDocumentSetResponseTypeDescriptionBuilder builder = new RetrieveDocumentSetResponseTypeDescriptionBuilder(); builder.setReturnValue(response); EventDescription eventDescription = getEventDescription(builder); assertEquals(1, eventDescription.getStatuses().size()); assertEquals(DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS, eventDescription.getStatuses().get(0)); assertEquals(1, eventDescription.getRespondingHCIDs().size()); assertEquals("homeCommunityId", eventDescription.getRespondingHCIDs().get(0)); assertTrue(CollectionUtils.isEmpty(eventDescription.getErrorCodes())); assertAlwaysNullAttributes(eventDescription); }
@Test public void twoRespondingHCIds() { RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); addStatus(response, DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS); addDocumentResponse(response, "homeCommunityId"); addDocumentResponse(response, "otherHomeCommunityId"); RetrieveDocumentSetResponseTypeDescriptionBuilder builder = new RetrieveDocumentSetResponseTypeDescriptionBuilder(); builder.setReturnValue(response); EventDescription eventDescription = getEventDescription(builder); assertEquals(1, eventDescription.getStatuses().size()); assertEquals(DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS, eventDescription.getStatuses().get(0)); assertEquals(2, eventDescription.getRespondingHCIDs().size()); assertEquals("homeCommunityId", eventDescription.getRespondingHCIDs().get(0)); assertEquals("otherHomeCommunityId", eventDescription.getRespondingHCIDs().get(1)); assertTrue(CollectionUtils.isEmpty(eventDescription.getErrorCodes())); assertAlwaysNullAttributes(eventDescription); }
@Test public void errorNoDocsInResponse() { RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); addStatus(response, DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_FAILURE); addError(response); RetrieveDocumentSetResponseTypeDescriptionBuilder builder = new RetrieveDocumentSetResponseTypeDescriptionBuilder(); builder.setReturnValue(response); EventDescription eventDescription = getEventDescription(builder); assertEquals(1, eventDescription.getStatuses().size()); assertEquals(DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_FAILURE, eventDescription.getStatuses().get(0)); assertTrue(eventDescription.getRespondingHCIDs() == null || eventDescription.getRespondingHCIDs().isEmpty()); assertEquals(1, eventDescription.getErrorCodes().size()); assertEquals(DocumentConstants.XDS_RETRIEVE_ERRORCODE_REPOSITORY_ERROR, eventDescription.getErrorCodes().get(0)); assertAlwaysNullAttributes(eventDescription); }
@Test public void keepDupErrorList() { RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); addStatus(response, DocumentConstants.XDS_RETRIEVE_RESPONSE_STATUS_FAILURE); addError(response); addError(response); RetrieveDocumentSetResponseTypeDescriptionBuilder builder = new RetrieveDocumentSetResponseTypeDescriptionBuilder(); builder.setReturnValue(response); EventDescription eventDescription = getEventDescription(builder); assertEquals(2, eventDescription.getErrorCodes().size()); assertEquals(DocumentConstants.XDS_RETRIEVE_ERRORCODE_REPOSITORY_ERROR, eventDescription.getErrorCodes().get(0)); assertEquals(DocumentConstants.XDS_RETRIEVE_ERRORCODE_REPOSITORY_ERROR, eventDescription.getErrorCodes().get(1)); }