Search in sources :

Example 6 with EqualsVerifierReport

use of nl.jqno.equalsverifier.EqualsVerifierReport in project checkstyle by checkstyle.

the class LineColumnTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    final EqualsVerifierReport ev = EqualsVerifier.forClass(LineColumn.class).usingGetClass().report();
    assertWithMessage("Error: " + ev.getMessage()).that(ev.isSuccessful()).isTrue();
}
Also used : EqualsVerifierReport(nl.jqno.equalsverifier.EqualsVerifierReport) Test(org.junit.jupiter.api.Test)

Example 7 with EqualsVerifierReport

use of nl.jqno.equalsverifier.EqualsVerifierReport in project checkstyle by checkstyle.

the class SuppressWithPlainTextCommentFilterTest method testEqualsAndHashCodeOfSuppressionClass.

/**
 * Our goal is 100% test coverage, for this we use white-box testing.
 * So we need access to the implementation details. For this reason, it is necessary
 * to use reflection to gain access to the inner type {@code Suppression} here.
 */
@Test
public void testEqualsAndHashCodeOfSuppressionClass() throws ClassNotFoundException {
    final Class<?> suppressionClass = TestUtil.getInnerClassType(SuppressWithPlainTextCommentFilter.class, "Suppression");
    final EqualsVerifierReport ev = EqualsVerifier.forClass(suppressionClass).usingGetClass().report();
    assertWithMessage("Error: " + ev.getMessage()).that(ev.isSuccessful()).isTrue();
}
Also used : EqualsVerifierReport(nl.jqno.equalsverifier.EqualsVerifierReport) Test(org.junit.jupiter.api.Test)

Example 8 with EqualsVerifierReport

use of nl.jqno.equalsverifier.EqualsVerifierReport in project checkstyle by checkstyle.

the class SuppressionCommentFilterTest method testEqualsAndHashCodeOfTagClass.

@Test
public void testEqualsAndHashCodeOfTagClass() {
    final Object tag = getTagsAfterExecutionOnDefaultFilter("//CHECKSTYLE:OFF").get(0);
    final EqualsVerifierReport ev = EqualsVerifier.forClass(tag.getClass()).usingGetClass().report();
    assertWithMessage("Error: " + ev.getMessage()).that(ev.isSuccessful()).isTrue();
}
Also used : EqualsVerifierReport(nl.jqno.equalsverifier.EqualsVerifierReport) Test(org.junit.jupiter.api.Test)

Example 9 with EqualsVerifierReport

use of nl.jqno.equalsverifier.EqualsVerifierReport in project checkstyle by checkstyle.

the class XpathFilterElementTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() throws Exception {
    final XPathEvaluator xpathEvaluator = new XPathEvaluator(Configuration.newConfiguration());
    final EqualsVerifierReport ev = EqualsVerifier.forClass(XpathFilterElement.class).withPrefabValues(XPathExpression.class, xpathEvaluator.createExpression("//METHOD_DEF"), xpathEvaluator.createExpression("//VARIABLE_DEF")).usingGetClass().withIgnoredFields("fileRegexp", "checkRegexp", "messageRegexp", "xpathExpression").report();
    assertWithMessage("Error: " + ev.getMessage()).that(ev.isSuccessful()).isTrue();
}
Also used : XPathExpression(net.sf.saxon.sxpath.XPathExpression) XPathEvaluator(net.sf.saxon.sxpath.XPathEvaluator) EqualsVerifierReport(nl.jqno.equalsverifier.EqualsVerifierReport) Test(org.junit.jupiter.api.Test)

Example 10 with EqualsVerifierReport

use of nl.jqno.equalsverifier.EqualsVerifierReport in project checkstyle by checkstyle.

the class CsvFilterElementTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    final EqualsVerifierReport ev = EqualsVerifier.forClass(CsvFilterElement.class).usingGetClass().report();
    assertWithMessage("Error: " + ev.getMessage()).that(ev.isSuccessful()).isTrue();
}
Also used : EqualsVerifierReport(nl.jqno.equalsverifier.EqualsVerifierReport) Test(org.junit.jupiter.api.Test)

Aggregations

EqualsVerifierReport (nl.jqno.equalsverifier.EqualsVerifierReport)11 Test (org.junit.jupiter.api.Test)11 TreeWalkerTest (com.puppycrawl.tools.checkstyle.TreeWalkerTest)1 XPathEvaluator (net.sf.saxon.sxpath.XPathEvaluator)1 XPathExpression (net.sf.saxon.sxpath.XPathExpression)1