Skip to content

Commit

Permalink
Issue checkstyle#4586: Moved resources for JavadocType check test
Browse files Browse the repository at this point in the history
  • Loading branch information
djydewang committed Jul 9, 2017
1 parent 812b341 commit 92194c6
Show file tree
Hide file tree
Showing 16 changed files with 921 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "javadoc" + File.separator + filename);
+ "javadoc" + File.separator
+ "javadoctype" + File.separator + filename);
}

@Test
Expand Down Expand Up @@ -79,7 +80,7 @@ public void testTags() throws Exception {
"302: " + getCheckMessage(MSG_JAVADOC_MISSING),
"327: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputTags.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeTags.java"), expected);
}

@Test
Expand All @@ -91,7 +92,7 @@ public void testInner() throws Exception {
"21: " + getCheckMessage(MSG_JAVADOC_MISSING),
"27: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputInner.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeInner.java"), expected);
}

@Test
Expand All @@ -104,7 +105,7 @@ public void testStrict() throws Exception {
"14: " + getCheckMessage(MSG_JAVADOC_MISSING),
"34: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
verify(checkConfig, getPath("InputJavadocTypePublicOnly.java"), expected);
}

@Test
Expand All @@ -115,7 +116,7 @@ public void testProtected() throws Exception {
final String[] expected = {
"7: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
verify(checkConfig, getPath("InputJavadocTypePublicOnly.java"), expected);
}

@Test
Expand All @@ -127,7 +128,8 @@ public void testPublic() throws Exception {
"7: " + getCheckMessage(MSG_JAVADOC_MISSING),
"38: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
verify(checkConfig,
getPath("InputJavadocTypeScopeInnerInterfaces.java"), expected);
}

@Test
Expand All @@ -141,7 +143,9 @@ public void testProtest() throws Exception {
"38: " + getCheckMessage(MSG_JAVADOC_MISSING),
"65: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
verify(checkConfig,
getPath("InputJavadocTypeScopeInnerInterfaces.java"),
expected);
}

@Test
Expand All @@ -156,7 +160,7 @@ public void testPkg() throws Exception {
"20: " + getCheckMessage(MSG_JAVADOC_MISSING),
"22: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputScopeInnerClasses.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeScopeInnerClasses.java"), expected);
}

@Test
Expand All @@ -169,7 +173,7 @@ public void testEclipse() throws Exception {
final String[] expected = {
"18: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputScopeInnerClasses.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeScopeInnerClasses.java"), expected);
}

@Test
Expand All @@ -180,7 +184,7 @@ public void testAuthorRequired() throws Exception {
final String[] expected = {
"13: " + getCheckMessage(MSG_MISSING_TAG, "@author"),
};
verify(checkConfig, getPath("InputWhitespace.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeWhitespace.java"), expected);
}

@Test
Expand All @@ -194,7 +198,7 @@ public void testAuthorRegularEx()
"58: " + getCheckMessage(MSG_MISSING_TAG, "@author"),
"94: " + getCheckMessage(MSG_MISSING_TAG, "@author"),
};
verify(checkConfig, getPath("InputJavadoc.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeJavadoc.java"), expected);
}

@Test
Expand All @@ -214,7 +218,7 @@ public void testAuthorRegularExError()
"94: " + getCheckMessage(MSG_MISSING_TAG, "@author"),
"103: " + getCheckMessage(MSG_TAG_FORMAT, "@author", "ABC"),
};
verify(checkConfig, getPath("InputJavadoc.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeJavadoc.java"), expected);
}

@Test
Expand All @@ -226,7 +230,7 @@ public void testVersionRequired()
final String[] expected = {
"13: " + getCheckMessage(MSG_MISSING_TAG, "@version"),
};
verify(checkConfig, getPath("InputWhitespace.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeWhitespace.java"), expected);
}

@Test
Expand All @@ -240,7 +244,7 @@ public void testVersionRegularEx()
"58: " + getCheckMessage(MSG_MISSING_TAG, "@version"),
"94: " + getCheckMessage(MSG_MISSING_TAG, "@version"),
};
verify(checkConfig, getPath("InputJavadoc.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeJavadoc.java"), expected);
}

@Test
Expand All @@ -263,7 +267,7 @@ public void testVersionRegularExError()
"103: " + getCheckMessage(MSG_TAG_FORMAT, "@version", "\\$Revision.*\\$"),
"112: " + getCheckMessage(MSG_TAG_FORMAT, "@version", "\\$Revision.*\\$"),
};
verify(checkConfig, getPath("InputJavadoc.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeJavadoc.java"), expected);
}

@Test
Expand All @@ -283,7 +287,7 @@ public void testScopes() throws Exception {
"111: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig,
getPath("InputNoJavadoc.java"),
getPath("InputJavadocTypeNoJavadoc.java"),
expected);
}

Expand All @@ -295,7 +299,9 @@ public void testLimitViolationsBySpecifyingTokens() throws Exception {
final String[] expected = {
"4: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputNoJavadocOnInterface.java"), expected);
verify(checkConfig,
getPath("InputJavadocTypeNoJavadocOnInterface.java"),
expected);
}

@Test
Expand All @@ -308,7 +314,7 @@ public void testScopes2() throws Exception {
"15: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig,
getPath("InputNoJavadoc.java"),
getPath("InputJavadocTypeNoJavadoc.java"),
expected);
}

Expand All @@ -329,7 +335,7 @@ public void testExcludeScope() throws Exception {
"111: " + getCheckMessage(MSG_JAVADOC_MISSING),
};
verify(checkConfig,
getPath("InputNoJavadoc.java"),
getPath("InputJavadocTypeNoJavadoc.java"),
expected);
}

Expand All @@ -344,7 +350,7 @@ public void testTypeParameters() throws Exception {
"47: " + getCheckMessage(MSG_MISSING_TAG, "@param <B>"),
"60:5: " + getCheckMessage(MSG_UNUSED_TAG, "@param", "<x>"),
};
verify(checkConfig, getPath("InputTypeParamsTags.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeTypeParamsTags.java"), expected);
}

@Test
Expand All @@ -357,7 +363,7 @@ public void testAllowMissingTypeParameters() throws Exception {
"44:8: " + getCheckMessage(MSG_UNUSED_TAG, "@param", "<C>"),
"60:5: " + getCheckMessage(MSG_UNUSED_TAG, "@param", "<x>"),
};
verify(checkConfig, getPath("InputTypeParamsTags.java"), expected);
verify(checkConfig, getPath("InputJavadocTypeTypeParamsTags.java"), expected);
}

@Test
Expand All @@ -369,7 +375,7 @@ public void testDontAllowUnusedParameterTag() throws Exception {
"7:4: " + getCheckMessage(MSG_UNUSED_TAG, "@param", "<BAD>"),
};
verify(checkConfig,
getPath("InputUnusedParamInJavadocForClass.java"),
getPath("InputJavadocTypeUnusedParamInJavadocForClass.java"),
expected);
}

Expand All @@ -381,7 +387,7 @@ public void testBadTag() throws Exception {
"5:4: " + getCheckMessage(MSG_UNKNOWN_TAG, "mytag"),
};
verify(checkConfig,
getPath("InputBadTag.java"),
getPath("InputJavadocTypeBadTag.java"),
expected);
}

Expand All @@ -392,7 +398,7 @@ public void testBadTagSuppress() throws Exception {
checkConfig.addAttribute("allowUnknownTags", "true");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
getPath("InputBadTag.java"),
getPath("InputJavadocTypeBadTag.java"),
expected);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.puppycrawl.tools.checkstyle.checks.javadoc.javadoctype;

/**
* The following is a bad tag.
* @mytag Hello
*/
public class InputJavadocTypeBadTag
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
////////////////////////////////////////////////////////////////////////////////
// Test case file for checkstyle.
// Created: 2001
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks.javadoc.javadoctype;

/**
* Tests having inner types
* @author Oliver Burn
**/
class InputJavadocTypeInner
{
// Ignore - two errors
class InnerInner2
{
// Ignore
public int fData;
}

// Ignore - 2 errors
interface InnerInterface2
{
// Ignore - should be all upper case
String data = "zxzc";

// Ignore
class InnerInterfaceInnerClass
{
// Ignore - need Javadoc and made private
public int rData;

/** needs to be made private unless allowProtected. */
protected int protectedVariable;

/** needs to be made private unless allowPackage. */
int packageVariable;
}
}

/** demonstrate bug in handling static final **/
protected static Object sWeird = new Object();
/** demonstrate bug in handling static final **/
static Object sWeird2 = new Object();

/** demonstrate bug in local final variable */
public interface Inter
{
}

public static void main()
{
Inter m = new Inter()
{
private static final int CDS = 1;

private int ABC;
};
}

/** annotation field incorrectly named. */
@interface InnerAnnotation
{
/** Ignore - should be all upper case. */
String data = "zxzc";
}

/** enum with public member variable */
enum InnerEnum
{
/** First constant */
A,

/** Second constant */
B;

/** Should be private */
public int someValue;
}
}
Loading

0 comments on commit 92194c6

Please sign in to comment.