### Question:
PostIngestionValidator { public boolean validateDatastreamExists(@Header(value="DatastreamTypesCheck") String datastreamTypesCheck, @Header(value="FedoraDatastreamIDsFound") String fedoraDatastreamIDsFound) { log.debug("DatastreamTypesCheck header {}", datastreamTypesCheck); log.debug("FedoraDatastreamIDsFound header {}", fedoraDatastreamIDsFound); if (datastreamTypesCheck == null || datastreamTypesCheck.trim().length()==0){ throw new IllegalArgumentException("DatastreamTypesCheck header is empty"); } if (fedoraDatastreamIDsFound == null || fedoraDatastreamIDsFound.trim().length()==0){ throw new IllegalArgumentException("FedoraDatastreamIDsFound header is empty"); } List<String> datastreamTypesCheckList = new ArrayList<>(Arrays.asList(datastreamTypesCheck.toUpperCase().trim().split("\\s*,\\s*"))); List<String> foundDatastreamsList = new ArrayList<>(Arrays.asList(fedoraDatastreamIDsFound.toUpperCase().trim().split("\\s*,\\s*"))); foundDatastreamsList.remove("SIDORA"); return datastreamTypesCheckList.containsAll(foundDatastreamsList) && foundDatastreamsList.containsAll(datastreamTypesCheckList); }  boolean validateDatastreamExists(@Header(value="DatastreamTypesCheck") String datastreamTypesCheck,
                                            @Header(value="FedoraDatastreamIDsFound") String fedoraDatastreamIDsFound); void validateField(Exchange exchange);  }### Answer:
@Test public void testValidateDatastreamTypeCheckMissingArgument() { thrown.expect(IllegalArgumentException.class); validator.validateDatastreamExists(null,"OBJ, TN"); }
@Test public void testValidateFedoraDSIDMissingArgument() { thrown.expect(IllegalArgumentException.class); validator.validateDatastreamExists("OBJ, TN", " "); }
@Test public void testValidateDatastreamExists() { String dataStreamTypesToCheck; String foundDatastreams; boolean result; dataStreamTypesToCheck = "OBJ"; foundDatastreams = "OBJ"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); dataStreamTypesToCheck = "OBJ,TN"; foundDatastreams = "OBJ,TN"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); dataStreamTypesToCheck = "OBJ,DC,TN"; foundDatastreams = "DC,OBJ,TN"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); dataStreamTypesToCheck = "OBJ,DC,TN"; foundDatastreams = "DC, OBJ , TN "; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); }
@Test public void testValidateDatastreamWhenSidoraDSExists() { String dataStreamTypesToCheck; String foundDatastreams; boolean result; dataStreamTypesToCheck = "OBJ,DC,TN"; foundDatastreams = "DC, OBJ, TN, SIDORA"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); dataStreamTypesToCheck = "DC, OBJ, TN, SIDORA"; foundDatastreams = "OBJ,DC,TN"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, false); }
@Test public void testValidateDatastreamCaseSensitivity() { String dataStreamTypesToCheck; String foundDatastreams; boolean result; dataStreamTypesToCheck = "OBJ,DC,TN"; foundDatastreams = "dc, obj, Tn, SIdora"; result = validator.validateDatastreamExists(dataStreamTypesToCheck, foundDatastreams); assertEquals(result, true); }