use of uk.gov.justice.subscription.file.read.SubscriptionDescriptorFileValidator in project microservice_framework by CJSCommonPlatform.
the class SubscriptionDescriptorFileParserFactory method create.
@Override
public SubscriptionDescriptorFileParser create() {
final SubscriptionDescriptorFileValidator subscriptionDescriptorFileValidator = new SubscriptionDescriptorFileValidator(new YamlFileToJsonObjectConverter());
final SubscriptionDescriptorParser subscriptionDescriptorParser = new SubscriptionDescriptorParser(subscriptionDescriptorFileValidator);
return new SubscriptionDescriptorFileParser(subscriptionDescriptorParser);
}
use of uk.gov.justice.subscription.file.read.SubscriptionDescriptorFileValidator in project microservice_framework by CJSCommonPlatform.
the class SubscriptionDescriptorFileValidatorTest method shouldNotThrowExceptionOnCorrectSubscriptionYaml.
@Test
public void shouldNotThrowExceptionOnCorrectSubscriptionYaml() throws IOException {
try {
final SubscriptionDescriptorFileValidator subscriptionDescriptorFileValidator = new SubscriptionDescriptorFileValidator(new YamlFileToJsonObjectConverter());
subscriptionDescriptorFileValidator.validate(getFromClasspath("subscription.yaml"));
} catch (ValidationException e) {
fail("Unexpected validation exception");
}
}
use of uk.gov.justice.subscription.file.read.SubscriptionDescriptorFileValidator in project microservice_framework by CJSCommonPlatform.
the class SubscriptionDescriptorParserTest method createParser.
@Before
public void createParser() {
final YamlFileToJsonObjectConverter yamlFileToJsonObjectConverter = new YamlFileToJsonObjectConverter();
final SubscriptionDescriptorFileValidator subscriptionDescriptorFileValidator = new SubscriptionDescriptorFileValidator(yamlFileToJsonObjectConverter);
subscriptionDescriptorParser = new SubscriptionDescriptorParser(subscriptionDescriptorFileValidator);
}
use of uk.gov.justice.subscription.file.read.SubscriptionDescriptorFileValidator in project microservice_framework by CJSCommonPlatform.
the class SubscriptionDescriptorFileValidatorTest method shouldThrowExceptionOnInCorrectSubscriptionYaml.
@Test
public void shouldThrowExceptionOnInCorrectSubscriptionYaml() {
try {
final SubscriptionDescriptorFileValidator subscriptionDescriptorFileValidator = new SubscriptionDescriptorFileValidator(new YamlFileToJsonObjectConverter());
subscriptionDescriptorFileValidator.validate(getFromClasspath("incorrect-subscription.yaml"));
fail();
} catch (ValidationException e) {
assertThat(e, is(instanceOf(ValidationException.class)));
assertThat(e.getMessage(), is("#/subscription_descriptor: required key [spec_version] not found"));
}
}
Aggregations