Skip to content

Commit

Permalink
Issue #13345: Enable example tests for SingleLineJavadocCheckExamples…
Browse files Browse the repository at this point in the history
…Test
  • Loading branch information
prathm3 committed May 10, 2024
1 parent c34d756 commit 13ed612
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

package com.puppycrawl.tools.checkstyle.checks.javadoc;

import org.junit.jupiter.api.Disabled;
import static com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.MSG_UNCLOSED_HTML_TAG;
import static com.puppycrawl.tools.checkstyle.checks.javadoc.SingleLineJavadocCheck.MSG_KEY;

import org.junit.jupiter.api.Test;

import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;

@Disabled("until https://github.com/checkstyle/checkstyle/issues/13345")
public class SingleLineJavadocCheckExamplesTest extends AbstractExamplesModuleTestSupport {
@Override
protected String getPackageLocation() {
Expand All @@ -34,10 +35,10 @@ protected String getPackageLocation() {
@Test
public void testExample1() throws Exception {
final String[] expected = {

"11: " + getCheckMessage(MSG_KEY),
};

verifyWithInlineConfigParser(getPath("Example1.txt"), expected);
verifyWithInlineConfigParser(getPath("Example1.java"), expected);
}

@Test
Expand All @@ -46,24 +47,26 @@ public void testExample2() throws Exception {

};

verifyWithInlineConfigParser(getPath("Example2.txt"), expected);
verifyWithInlineConfigParser(getPath("Example2.java"), expected);
}

@Test
public void testExample3() throws Exception {
final String[] expected = {

"13: " + getCheckMessage(MSG_KEY),
"25: " + getCheckMessage(MSG_KEY),
};

verifyWithInlineConfigParser(getPath("Example3.txt"), expected);
verifyWithInlineConfigParser(getPath("Example3.java"), expected);
}

@Test
public void testExample4() throws Exception {
final String[] expected = {

"13: " + getCheckMessage(MSG_KEY),
"31: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"),
};

verifyWithInlineConfigParser(getPath("Example4.txt"), expected);
verifyWithInlineConfigParser(getPath("Example4.java"), expected);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*xml
<module name="Checker">
<module name="TreeWalker">
<module name="SingleLineJavadoc"/>
</module>
</module>
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.singlelinejavadoc;
// xdoc section -- start
public class Example1 {
/** @see Math */ // violation
public int foo() {
return 42;
}

/**
* @return 42
*/
public int bar() {
return 42;
}

/** {@link #equals(Object)} */
public int baz() {
return 42;
}

/**
* <p>the answer to the ultimate question
*/
public int magic() {
return 42;
}

/**
* <p>the answer to the ultimate question</p>
*/
public int foobar() {
return 42;
}
}
// xdoc section -- end

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*xml
<module name="Checker">
<module name="TreeWalker">
<module name="SingleLineJavadoc">
<property name="ignoredTags" value="@inheritDoc, @see"/>
</module>
</module>
</module>
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.singlelinejavadoc;
// xdoc section -- start
public class Example2 {
/** @see Math */
public int foo() {
return 42;
}

/**
* @return 42
*/
public int bar() {
return 42;
}

/** {@link #equals(Object)} */
public int baz() {
return 42;
}

/**
* <p>the answer to the ultimate question
*/
public int magic() {
return 42;
}

/**
* <p>the answer to the ultimate question</p>
*/
public int foobar() {
return 42;
}
}
// xdoc section -- end

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*xml
<module name="Checker">
<module name="TreeWalker">
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
</module>
</module>
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.singlelinejavadoc;
// xdoc section -- start
public class Example3 {
/** @see Math */ // violation
public int foo() {
return 42;
}

/**
* @return 42
*/
public int bar() {
return 42;
}

/** {@link #equals(Object)} */ // violation
public int baz() {
return 42;
}

/**
* <p>the answer to the ultimate question
*/
public int magic() {
return 42;
}

/**
* <p>the answer to the ultimate question</p>
*/
public int foobar() {
return 42;
}
}
// xdoc section -- end

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*xml
<module name="Checker">
<module name="TreeWalker">
<module name="SingleLineJavadoc">
<property name="violateExecutionOnNonTightHtml" value="true"/>
</module>
</module>
</module>
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.singlelinejavadoc;
// xdoc section -- start
public class Example4 {
/** @see Math */ // violation
public int foo() {
return 42;
}

/**
* @return 42
*/
public int bar() {
return 42;
}

/** {@link #equals(Object)} */
public int baz() {
return 42;
}

/**
* <p>the answer to the ultimate question // violation
*/
public int magic() {
return 42;
}

/**
* <p>the answer to the ultimate question</p>
*/
public int foobar() {
return 42;
}
}
// xdoc section -- end

0 comments on commit 13ed612

Please sign in to comment.