summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-10-05 17:11:30 +0200
committerDavid Gageot <david@gageot.net>2012-10-05 17:18:44 +0200
commit3a09a52553ef62c734044f98aad384e3dabcc64d (patch)
tree7796f1b79d8a616ec3fb069bdfc5cd5f682880f8 /sonar-plugin-api
parent3582904207a87f818846fbc7cce7c50d5194771f (diff)
downloadsonarqube-3a09a52553ef62c734044f98aad384e3dabcc64d.tar.gz
sonarqube-3a09a52553ef62c734044f98aad384e3dabcc64d.zip
SONAR-3758 Test exclusion patterns
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java3
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java6
2 files changed, 3 insertions, 6 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
index cd142ae6ce2..fb4bde75189 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
@@ -174,9 +174,6 @@ public class JavaFile extends Resource<JavaPackage> {
*/
@Override
public boolean matchFilePattern(String antPattern) {
- if (unitTest) {
- return false;
- }
String fileKey = getKey();
if (!fileKey.endsWith(".java")) {
fileKey += ".java";
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
index afe33c33f22..72187079486 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
@@ -210,16 +210,16 @@ public class JavaFileTest {
* See http://jira.codehaus.org/browse/SONAR-1449
*/
@Test
- public void doNotMatchAjPattern() {
+ public void doNotMatchAPattern() {
JavaFile file = new JavaFile("org.sonar.commons.Foo");
assertFalse(file.matchFilePattern("**/*.aj"));
assertTrue(file.matchFilePattern("**/*.java"));
}
@Test
- public void doNotExcludeTestFiles() {
+ public void should_exclude_test_files() {
JavaFile unitTest = new JavaFile("org.sonar.commons.FooTest", true);
- assertFalse(unitTest.matchFilePattern("**/*"));
+ assertTrue(unitTest.matchFilePattern("**/*"));
}
private File newDir(String dirName) {