@Test public void hasJavaSourceFiles() { final DefaultProjectFileSystem fs = newDefaultProjectFileSystem(project); assertThat(fs.hasJavaSourceFiles(), is(true)); PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*.java"); project.setConfiguration(conf); assertThat(fs.hasJavaSourceFiles(), is(false)); }
@Test public void applyExclusionPatternsToSourceFiles() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/B*.java"); project.setConfiguration(conf); final DefaultProjectFileSystem fs = newDefaultProjectFileSystem(project); assertThat(fs.getJavaSourceFiles().size(), is(1)); assertThat(fs.getJavaSourceFiles(), hasItem(named("Whizz.java"))); }
@Test public void doNotApplyExclusionPatternsToTestFiles() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/B*.java"); project.setConfiguration(conf); final DefaultProjectFileSystem fs = newDefaultProjectFileSystem(project); assertThat(fs.getTestFiles(Java.INSTANCE).size(), is(1)); assertThat(fs.getTestFiles(Java.INSTANCE), hasItem(named("BarTest.java"))); }
/** See http://jira.codehaus.org/browse/SONAR-1449 */ @Test public void exclusionPatternOnAjFiles() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*.aj"); project.setConfiguration(conf); final DefaultProjectFileSystem fs = newDefaultProjectFileSystem(project); assertThat(fs.getSourceFiles(Java.INSTANCE).size(), is(2)); assertThat(fs.getSourceFiles(Java.INSTANCE), hasItem(named("Whizz.java"))); assertThat(fs.getSourceFiles(Java.INSTANCE), hasItem(named("Bar.java"))); }