Redirect warning in compaction

This commit is contained in:
Xavi Aracil
2022-11-24 13:51:04 +01:00
parent 0ba347d8f0
commit a629fc8372
2 changed files with 41 additions and 23 deletions
@@ -2,11 +2,13 @@ package org.oneedtech.inspect.vc;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.oneedtech.inspect.test.Assertions.assertValid;
import static org.oneedtech.inspect.test.Assertions.assertWarning;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.oneedtech.inspect.core.Inspector.Behavior;
import org.oneedtech.inspect.core.report.Report;
@@ -22,7 +24,7 @@ public class OB20Tests {
validator = new TestBuilder()
.add(new URI("https://www.example.org/"), "ob20/assets")
.set(Behavior.TEST_INCLUDE_SUCCESS, true)
.set(Behavior.TEST_INCLUDE_WARNINGS, true)
.set(Behavior.TEST_INCLUDE_WARNINGS, false)
.set(Behavior.VALIDATOR_FAIL_FAST, true)
.set(OB20Inspector.Behavior.ALLOW_LOCAL_REDIRECTION, true)
.build();
@@ -36,4 +38,27 @@ public class OB20Tests {
assertValid(report);
});
}
@Nested
static class WarningTests {
@BeforeAll
static void setup() throws URISyntaxException {
validator = new TestBuilder()
.add(new URI("https://www.example.org/"), "ob20/assets")
.set(Behavior.TEST_INCLUDE_SUCCESS, true)
.set(Behavior.TEST_INCLUDE_WARNINGS, true)
.set(Behavior.VALIDATOR_FAIL_FAST, true)
.set(OB20Inspector.Behavior.ALLOW_LOCAL_REDIRECTION, true)
.build();
}
@Test
void testWarningRedirectionJsonValid() {
assertDoesNotThrow(()->{
Report report = validator.run(Samples.OB20.JSON.WARNING_REDIRECTION_ASSERTION_JSON.asFileResource());
if(verbose) PrintHelper.print(report, true);
assertWarning(report);
});
}
}
}