Skip to content

Commit

Permalink
Merge 565f091 into fbab1b4
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkravin committed Sep 3, 2014
2 parents fbab1b4 + 565f091 commit 9ac6aec
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 17 deletions.
21 changes: 21 additions & 0 deletions sevntu-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidInstantiationCheck.java</source>
<source>sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidInstantiationCheckWithAsterisk.java</source>
<source>sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidInstantiationCheckWithoutDots.java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testNormalWork() throws Exception

String[] expected = {
"13:21: " + getCheckMessage(MSG_KEY, "File"),
"14:21: " + getCheckMessage(MSG_KEY, "File"),
"14:22: " + getCheckMessage(MSG_KEY, "File"),
"15:20: " + getCheckMessage(MSG_KEY, "String"),
};

Expand All @@ -67,10 +67,10 @@ public void testNormalWork() throws Exception
public void testNormalWork2() throws Exception
{

checkConfig.addAttribute("forbiddenClasses", "File");
checkConfig.addAttribute("forbiddenClasses", "com.github.sevntu.checkstyle.checks.test.utils.File");

String[] expected = {
"13:21: " + getCheckMessage(MSG_KEY, "File"),
"12:68: " + getCheckMessage(MSG_KEY, "File"),
};

verify(checkConfig, getPath("InputForbidInstantiationCheckWithoutDots.java"), expected);
Expand All @@ -83,8 +83,8 @@ public void testNormalWork3() throws Exception
checkConfig.addAttribute("forbiddenClasses", "java.io.File , java.lang.String , ");

String[] expected = {
"14:21: " + getCheckMessage(MSG_KEY, "File"),
"15:20: " + getCheckMessage(MSG_KEY, "String"),
"13:22: " + getCheckMessage(MSG_KEY, "File"),
"14:20: " + getCheckMessage(MSG_KEY, "String"),
};

verify(checkConfig, getPath("InputForbidInstantiationCheckWithoutDots.java"), expected);
Expand All @@ -99,7 +99,7 @@ public void testAsteriskInInput() throws Exception

String[] expected = {
"13:21: " + getCheckMessage(MSG_KEY, "File"),
"14:21: " + getCheckMessage(MSG_KEY, "File"),
"14:22: " + getCheckMessage(MSG_KEY, "File"),
"15:20: " + getCheckMessage(MSG_KEY, "String"),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package project;
package com.github.sevntu.checkstyle.checks.coding;

//import File;
import java.io.File;
Expand All @@ -10,8 +10,8 @@ public void method() {
int []x = new int[10];
new InputForbidInstantiationCheck();
NullPointerException ex2 = new java.lang.NullPointerException("message"); // !
File File = new File();
File File = new java.io.File(); // 2 !
File File = new File("");
File File1 = new java.io.File(""); // 2 !
String a = new String(); // 2 !
InputForbidInstantiationCheck c = new InputForbidInstantiationCheck();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package project;
package com.github.sevntu.checkstyle.checks.coding;

//import File;
import java.io.*;
Expand All @@ -10,8 +10,8 @@ public void method() {
int []x = new int[10];
new InputForbidInstantiationCheck();
NullPointerException ex2 = new java.lang.NullPointerException("message"); // !
File File = new File();
File File = new java.io.File(); // 2 !
File File = new File("");
File File1 = new java.io.File(""); // 2 !
String a = new String(); // 2 !
InputForbidInstantiationCheck c = new InputForbidInstantiationCheck();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package project;
package com.github.sevntu.checkstyle.checks.coding;

import File;
//import java.io.File;
import java.io.File;

public class InputForbidInstantiationCheckWithoutDots
{
Expand All @@ -10,8 +9,8 @@ public void method() {
int []x = new int[10];
new InputForbidInstantiationCheck();
NullPointerException ex2 = new java.lang.NullPointerException("message"); // !
File File = new File();
File File = new java.io.File(); // 2 !
com.github.sevntu.checkstyle.checks.test.utils.File File = new com.github.sevntu.checkstyle.checks.test.utils.File(""); // !
File File1 = new java.io.File(""); // 2 !
String a = new String(); // 2 !
InputForbidInstantiationCheck c = new InputForbidInstantiationCheck();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.github.sevntu.checkstyle.checks.test.utils;

public class File
{

public File(String string)
{
}

}

0 comments on commit 9ac6aec

Please sign in to comment.