@Test public void testInvalidProtobufSchema() throws Exception { ContentHandle content = resourceToContentHandle("protobuf-invalid.proto"); ProtobufContentValidator validator = new ProtobufContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.SYNTAX_ONLY, content); }); }
@Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { ProtobufFile.toProtoFileElement(artifactContent.content()); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Protobuf artifact.", e); } } }
ProtobufContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { ProtobufFile.toProtoFileElement(artifactContent.content()); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Protobuf artifact.", e); } } } }
ProtobufContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { ProtobufFile.toProtoFileElement(artifactContent.content()); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Protobuf artifact.", e); } } } ProtobufContentValidator(); }
ProtobufContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { ProtobufFile.toProtoFileElement(artifactContent.content()); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Protobuf artifact.", e); } } } ProtobufContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent); }
ProtobufContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try { ProtobufFile.toProtoFileElement(artifactContent.content()); } catch (Exception e) { throw new InvalidContentException("Syntax violation for Protobuf artifact.", e); } } } ProtobufContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }