### Question:
PDSJobConfigurationValidator { public void assertPDSConfigurationValid(PDSJobConfiguration configuration) { String message = createValidationErrorMessage(configuration); if (message == null) { return; } LOG.warn("pds job configuration not valid - message:{}", message); throw new PDSNotAcceptableException("Configuration invalid:" + message); }  void assertPDSConfigurationValid(PDSJobConfiguration configuration);  }### Answer:
@Test public void when_a_server_configuration_does_contain_optional_parameters_and_jobconfig_not_than_no_exception_is_thrown() { PDSJobConfiguration config = prepareValidConfig(); PDSProdutParameterDefinition optional= new PDSProdutParameterDefinition(); optional.setKey("the.optional.key"); setup1.getParameters().getOptional().add(optional); validatorToTest.assertPDSConfigurationValid(config); }
@Test public void when_a_server_configuration_does_contain_mandatory_parameters_and_jobconfig_not_than_an_exception_is_thrown() { expected.expect(PDSNotAcceptableException.class); expected.expectMessage("mandatory parameter not found"); expected.expectMessage("the.necessary.key"); PDSJobConfiguration config = prepareValidConfig(); PDSProdutParameterDefinition mandatoryParameter= new PDSProdutParameterDefinition(); mandatoryParameter.setKey("the.necessary.key"); setup1.getParameters().getMandatory().add(mandatoryParameter); validatorToTest.assertPDSConfigurationValid(config); }
@Test public void when_a_server_configuration_does_not_contain_product_id_an_exception_is_thrown() { expected.expect(PDSNotAcceptableException.class); expected.expectMessage("does not support product identifier"); PDSJobConfiguration config = prepareValidConfig(); config.setProductId("productid-notknown-by-server"); validatorToTest.assertPDSConfigurationValid(config); }
@Test public void null_configuration_throws_not_acceptable_with_message() { expected.expect(PDSNotAcceptableException.class); expected.expectMessage("may not be null"); validatorToTest.assertPDSConfigurationValid(null); }
@Test public void configuration_without_sechub_job_UUID_throws_not_acceptable_with_message() { PDSJobConfiguration config = prepareValidConfig(); config.setSechubJobUUID(null); expected.expect(PDSNotAcceptableException.class); expected.expectMessage("sechub job UUID not set"); validatorToTest.assertPDSConfigurationValid(config); }
@Test public void configuration_with_necessary_parts_set_throws_no_exception() { PDSJobConfiguration config = prepareValidConfig(); validatorToTest.assertPDSConfigurationValid(config); }