diff --git a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java index 3ed096cc6..ec665e64e 100644 --- a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java +++ b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java @@ -257,7 +257,8 @@ private void initialize() severities.put(MessageId.OPF_084, Severity.ERROR); severities.put(MessageId.OPF_085, Severity.WARNING); severities.put(MessageId.OPF_086, Severity.WARNING); - severities.put(MessageId.OPF_087, Severity.ERROR); + severities.put(MessageId.OPF_086b, Severity.USAGE); + severities.put(MessageId.OPF_087, Severity.USAGE); severities.put(MessageId.OPF_088, Severity.USAGE); severities.put(MessageId.OPF_089, Severity.ERROR); diff --git a/src/main/java/com/adobe/epubcheck/messages/MessageId.java b/src/main/java/com/adobe/epubcheck/messages/MessageId.java index ec3b814cd..d95aa7ccb 100644 --- a/src/main/java/com/adobe/epubcheck/messages/MessageId.java +++ b/src/main/java/com/adobe/epubcheck/messages/MessageId.java @@ -250,6 +250,7 @@ public enum MessageId implements Comparable OPF_084("OPF-084"), OPF_085("OPF-085"), OPF_086("OPF-086"), + OPF_086b("OPF-086b"), OPF_087("OPF-087"), OPF_088("OPF-088"), OPF_089("OPF-089"), diff --git a/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java b/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java index fff01f29f..c86e10da9 100644 --- a/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java +++ b/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java @@ -122,11 +122,14 @@ private static Set parseProperties(String value, Map expectedErrors = Lists.newLinkedList(); private List expectedWarnings = Lists.newLinkedList(); + private List expectedUsages = Lists.newLinkedList(); private List expectedFatals = Lists.newLinkedList(); private ValidationContext context; private ValidationReport report; @@ -143,6 +145,7 @@ public boolean isDeprecated() public void before() { report = new ValidationReport(VocabTest.class.getSimpleName()); + report.setReportingLevel(ReportingLevel.Usage); context = new ValidationContextBuilder().resourceProvider(new ThrowingResourceProvider()) .report(report).build(); } @@ -161,9 +164,10 @@ private Set testPropertyList(String value, Map vocabs, outWriter.println(report); } + assertEquals("The fatal error results do not match", expectedFatals, report.getFatalErrorIds()); assertEquals("The error results do not match", expectedErrors, report.getErrorIds()); assertEquals("The warning results do not match", expectedWarnings, report.getWarningIds()); - assertEquals("The fatal error results do not match", expectedFatals, report.getFatalErrorIds()); + assertEquals("The usage results do not match", expectedUsages, report.getUsageIds()); return props; } @@ -183,9 +187,10 @@ private Optional testProperty(String value, Map vocabs, outWriter.println(report); } + assertEquals("The fatal error results do not match", expectedFatals, report.getFatalErrorIds()); assertEquals("The error results do not match", expectedErrors, report.getErrorIds()); assertEquals("The warning results do not match", expectedWarnings, report.getWarningIds()); - assertEquals("The fatal error results do not match", expectedFatals, report.getFatalErrorIds()); + assertEquals("The usages results do not match", expectedUsages, report.getUsageIds()); return prop; } @@ -207,10 +212,11 @@ private Map testVocabs(String value, boolean verbose) outWriter.println(testReport); } - assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds()); - assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds()); assertEquals("The fatal error results do not match", expectedFatals, testReport.getFatalErrorIds()); + assertEquals("The error results do not match", expectedErrors, testReport.getErrorIds()); + assertEquals("The warning results do not match", expectedWarnings, testReport.getWarningIds()); + assertEquals("The usages results do not match", expectedUsages, testReport.getUsageIds()); return result; } @@ -218,9 +224,10 @@ private Map testVocabs(String value, boolean verbose) @Before public void setup() { + expectedFatals.clear(); expectedErrors.clear(); expectedWarnings.clear(); - expectedFatals.clear(); + expectedUsages.clear(); } @Test(expected = NullPointerException.class) @@ -268,7 +275,7 @@ public void testDeprecated() @Test public void testDisallowed() { - expectedErrors.add(MessageId.OPF_087); + expectedUsages.add(MessageId.OPF_087); testProperty("disallowed:prop", PREDEF_VOCABS); }