aboutsummaryrefslogtreecommitdiff
path: root/src/it
diff options
context:
space:
mode:
authorVladislav Lisetskiy <vladlis54@gmail.com>2015-09-14 17:11:01 +0300
committerRoman Ivanov <ivanov-jr@mail.ru>2015-09-15 17:11:43 -0700
commitca15d3d758a857dffcfd8fb7a739b32caef797e1 (patch)
tree0e79a78ba1df5f5b2abf4891921a7b6d336c34a3 /src/it
parent2aeea0413772d6083e90882838c7d41a488f5423 (diff)
downloadcheckstyle-ca15d3d758a857dffcfd8fb7a739b32caef797e1.tar.gz
Issue #2074: Correct NonEmptyAtclauseDescription IT
Diffstat (limited to 'src/it')
-rw-r--r--src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java69
-rw-r--r--src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java42
-rw-r--r--src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java46
3 files changed, 91 insertions, 66 deletions
diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java
index e0f9b05f8..630216b0e 100644
--- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java
+++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java
@@ -1,5 +1,6 @@
package com.google.checkstyle.test.chapter7javadoc.rule713atclauses;
+
import java.io.File;
import org.junit.BeforeClass;
@@ -8,7 +9,7 @@ import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.google.checkstyle.test.base.ConfigurationBuilder;
import com.puppycrawl.tools.checkstyle.api.Configuration;
-import com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck;
+import com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck;
public class NonEmptyAtclauseDescriptionTest extends BaseCheckTestSupport{
@@ -20,42 +21,62 @@ public class NonEmptyAtclauseDescriptionTest extends BaseCheckTestSupport{
}
@Test
- public void noFinalizerBasicTest() throws Exception {
-
- String msg = getCheckMessage(NoFinalizerCheck.class, "avoid.finalizer.method");
+ public void testDefaultConfiguration() throws Exception {
+ String msg = getCheckMessage(NonEmptyAtclauseDescriptionCheck.class, "non.empty.atclause");
final String[] expected = {
- "5: " + msg,
+ "34: " + msg,
+ "35: " + msg,
+ "36: " + msg,
+ "37: " + msg,
+ "38: " + msg,
+ "39: " + msg,
+ "48: " + msg,
+ "49: " + msg,
+ "50: " + msg,
+ "51: " + msg,
+ "52: " + msg,
};
- Configuration checkConfig = builder.getCheckConfig("NoFinalizer");
- String filePath = builder.getFilePath("NoFinalizerInput");
+ Configuration checkConfig = builder.getCheckConfig("NonEmptyAtclauseDescription");
+ String filePath = builder.getFilePath("InputNonEmptyAtclauseDescriptionCheck");
- Integer[] warnList = builder.getLinesWithWarn(filePath);
+ Integer[] warnList = getLineNumbersFromExpected(expected);
verify(checkConfig, filePath, expected, warnList);
}
-
+
@Test
- public void noFinalizerExtendedTest() throws Exception {
-
- String msg = getCheckMessage(NoFinalizerCheck.class, "avoid.finalizer.method");
+ public void testSpaceSequence() throws Exception {
+ String msg = getCheckMessage(NonEmptyAtclauseDescriptionCheck.class, "non.empty.atclause");
final String[] expected = {
- "9: " + msg,
- "21: " + msg,
- "33: " + msg,
- "45: " + msg,
- "57: " + msg,
- "69: " + msg,
- "79: " + msg,
- "119: " + msg,
- "136: " + msg,
+ "27: " + msg,
+ "28: " + msg,
+ "29: " + msg,
+ "38: " + msg,
+ "39: " + msg,
+ "40: " + msg,
};
- Configuration checkConfig = builder.getCheckConfig("NoFinalizer");
- String filePath = builder.getFilePath("NoFinalizeExtendInput");
+ Configuration checkConfig = builder.getCheckConfig("NonEmptyAtclauseDescription");
+ String filePath = builder.getFilePath("InputNonEmptyAtclauseDescriptionCheckSpaceSeq");
- Integer[] warnList = builder.getLinesWithWarn(filePath);
+ Integer[] warnList = getLineNumbersFromExpected(expected);
verify(checkConfig, filePath, expected, warnList);
}
+
+ /**
+ * Gets line numbers with violations from an array with expected messages.
+ * This is used as using "warn" comments in input files would affects the work
+ * of the Check.
+ * @param expected an array with expected messages.
+ * @return Integer array with numbers of lines with violations.
+ */
+ private static Integer[] getLineNumbersFromExpected(String[] expected) {
+ Integer[] result = new Integer[expected.length];
+ for (int i = 0; i < expected.length; i++) {
+ result[i] = Integer.valueOf(expected[i].substring(0, expected[i].indexOf(':')));
+ }
+ return result;
+ }
}
diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java
index c729d51db..1951d149c 100644
--- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java
+++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java
@@ -3,48 +3,6 @@ package com.google.checkstyle.test.chapter7javadoc.rule713atclauses;
class InputNonEmptyAtclauseDescriptionCheck
{
/**
- * Some javadoc.
- * @param a Some javadoc.
- * @param b Some javadoc.
- */
- public InputNonEmptyAtclauseDescriptionCheck(String a, int b)
- {
-
- }
-
- /**
- * Some javadoc.
- * @param a Some javadoc.
- * @deprecated Some javadoc.
- */
- public InputNonEmptyAtclauseDescriptionCheck(String a)
- {
-
- }
-
- /**
- * Some javadoc.
- * @param a
- * @param b
- * @param c
- */
- public InputNonEmptyAtclauseDescriptionCheck(String a, int b, double c)
- {
-
- }
-
- /**
- *
- * @param a
- * @param e
- * @deprecated
- */
- public InputNonEmptyAtclauseDescriptionCheck(String a, boolean e)
- {
-
- }
-
- /**
* Some javadoc
* @param a Some javadoc
* @param b Some javadoc
diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java
new file mode 100644
index 000000000..8766bcea5
--- /dev/null
+++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java
@@ -0,0 +1,46 @@
+package com.google.checkstyle.test.chapter7javadoc.rule713atclauses;
+
+class InputNonEmptyAtclauseDescriptionCheckSpaceSeq
+{
+ /**
+ * Some javadoc.
+ * @param a Some javadoc.
+ * @param b Some javadoc.
+ */
+ public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, int b)
+ {
+
+ }
+
+ /**
+ * Some javadoc.
+ * @param a Some javadoc.
+ * @deprecated Some javadoc.
+ */
+ public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a)
+ {
+
+ }
+
+ /**
+ * Some javadoc.
+ * @param a
+ * @param b
+ * @param c
+ */
+ public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, int b, double c)
+ {
+
+ }
+
+ /**
+ *
+ * @param a
+ * @param e
+ * @deprecated
+ */
+ public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, boolean e)
+ {
+
+ }
+}