/** 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"))); }
@Test public void shouldUseExtendedFilters() { DefaultProjectFileSystem fsWithoutFilter = newDefaultProjectFileSystem(project); assertThat(fsWithoutFilter.getSourceFiles().size(), is(2)); assertThat(fsWithoutFilter.getSourceFiles(), hasItem(named("Bar.java"))); FileFilter filter = new FileFilter() { public boolean accept(File file) { return !StringUtils.equals(file.getName(), "Bar.java"); } }; DefaultProjectFileSystem fsWithFilter = new DefaultProjectFileSystem(project, new Languages(Java.INSTANCE), filter); assertThat(fsWithFilter.getSourceFiles().size(), is(1)); assertThat(fsWithFilter.getSourceFiles(), not(hasItem(named("Bar.java")))); }