Skip to content

Commit

Permalink
Merge pull request #108 from uchitsa/qulice-maven-plugin-0.23.0
Browse files Browse the repository at this point in the history
Update qulice maven plugin 0.23.0
  • Loading branch information
yegor256 authored Dec 2, 2024
2 parents 4cfb268 + a93ed0b commit af68744
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.21.0</version>
<version>0.23.0</version>
<configuration>
<excludes>
<exclude>xml:/src/test/resources/com/jcabi/w3c/invalid-html-response.xml</exclude>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/w3c/AbstractBaseValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ protected static String entity(final String name, final String content,
* @return The validation response just built
*/
protected static ValidationResponse success(final String type) {
final DefaultValidationResponse resp = new DefaultValidationResponse(
return new DefaultValidationResponse(
true,
URI.create("http://localhost/success"),
type,
Charset.defaultCharset()
);
return resp;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/jcabi/w3c/DefaultCssValidatorITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public final class DefaultCssValidatorITCase {
@RetryOnFailure(verbose = false)
public void validatesCssDocument() throws Exception {
MatcherAssert.assertThat(
"css document should be valid",
ValidatorBuilder.CSS.validate("* { }").errors(),
Matchers.empty()
);
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/com/jcabi/w3c/DefaultCssValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void validatesCssDocument() throws Exception {
final Validator validator = new DefaultCssValidator(container.home());
final ValidationResponse response = validator.validate("* { }");
container.stop();
MatcherAssert.assertThat(response.toString(), response.valid());
MatcherAssert.assertThat("document should be valid", response.valid(), Matchers.is(true));
}

/**
Expand All @@ -75,7 +75,7 @@ public void ignoresEntireDocument() throws Exception {
final ValidationResponse response = validator.validate(
this.documentWithIgnore()
);
MatcherAssert.assertThat(response.toString(), response.valid());
MatcherAssert.assertThat(response.toString(), response.valid(), Matchers.is(true));
}

/**
Expand Down Expand Up @@ -114,6 +114,7 @@ public void throwsIoExceptionWhenValidationServerErrorOccurred()
}
}
MatcherAssert.assertThat(
"must be error-free",
caught,
Matchers.containsInAnyOrder(
responses.toArray(new Integer[0])
Expand All @@ -136,7 +137,7 @@ public void callsServerWhenPatternNotMatched() throws Exception {
try {
container.start();
new DefaultCssValidator(container.home()).validate("html { }");
MatcherAssert.assertThat(container.queries(), Matchers.is(1));
MatcherAssert.assertThat("must be 1 match", container.queries(), Matchers.is(1));
} finally {
container.stop();
}
Expand All @@ -154,7 +155,7 @@ public void replyWhenPatternMatched() throws Exception {
container.start();
new DefaultCssValidator(container.home())
.validate(this.documentWithIgnore());
MatcherAssert.assertThat(container.queries(), Matchers.is(0));
MatcherAssert.assertThat("should not respond", container.queries(), Matchers.is(0));
} finally {
container.stop();
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/jcabi/w3c/DefaultHtmlValidatorITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public final class DefaultHtmlValidatorITCase {
@RetryOnFailure(verbose = false)
public void validatesHtmlDocument() throws Exception {
MatcherAssert.assertThat(
"html document should be error-free",
ValidatorBuilder.HTML.validate(
StringUtils.join(
"<!DOCTYPE html>",
Expand All @@ -71,6 +72,7 @@ public void validatesHtmlDocument() throws Exception {
@Test
public void validatesInvalidHtmlDocument() throws Exception {
MatcherAssert.assertThat(
"html document should be with errors",
ValidatorBuilder.HTML.validate(
"this is an invalid html"
).errors(),
Expand Down
17 changes: 9 additions & 8 deletions src/test/java/com/jcabi/w3c/DefaultHtmlValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void validatesHtmlDocument() throws Exception {
container.stop();
MatcherAssert.assertThat(
response.toString(),
response.valid()
response.valid(),
Matchers.is(true)
);
}

Expand All @@ -92,7 +93,8 @@ public void validateInvalidHtml() throws Exception {
container.stop();
MatcherAssert.assertThat(
"Validity must be invalid!",
!response.valid()
response.valid(),
Matchers.is(false)
);
MatcherAssert.assertThat(
"Must has at least one error",
Expand Down Expand Up @@ -144,7 +146,7 @@ public void throwsIoExceptionWhenValidationServerErrorOccurred()
}
}
final Integer[] data = responses.toArray(new Integer[0]);
MatcherAssert.assertThat(caught, Matchers.containsInAnyOrder(data));
MatcherAssert.assertThat("must be error-free", caught, Matchers.containsInAnyOrder(data));
}

/**
Expand All @@ -166,12 +168,11 @@ private String validReturn() {
* @throws IOException if something goes wrong.
*/
private String invalidHtmlResponse() throws IOException {
final InputStream file = DefaultHtmlValidator.class.getResourceAsStream(
try (InputStream file = DefaultHtmlValidator.class.getResourceAsStream(
"invalid-html-response.xml"
);
final String xml = IOUtils.toString(file, StandardCharsets.UTF_8);
IOUtils.closeQuietly(file);
return xml;
)) {
return IOUtils.toString(file, StandardCharsets.UTF_8);
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/jcabi/w3c/DefectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void transformsItselfToString() throws Exception {
" some message "
);
MatcherAssert.assertThat(
"defect should be transformed to string",
defect,
Matchers.hasToString(
// @checkstyle LineLength (1 line)
Expand Down

0 comments on commit af68744

Please sign in to comment.