use of com.puppycrawl.tools.checkstyle.api.FilterSet in project checkstyle by checkstyle.
the class FilterSetTest method testToString2.
@Test
public void testToString2() {
final FilterSet filterSet = new FilterSet();
filterSet.addFilter(new SeverityMatchFilter());
assertNotNull("size is the same", filterSet.toString());
}
use of com.puppycrawl.tools.checkstyle.api.FilterSet in project checkstyle by checkstyle.
the class SuppressionsLoaderTest method testLoadFromClasspath.
@Test
public void testLoadFromClasspath() throws Exception {
final FilterSet fc = SuppressionsLoader.loadSuppressions(getPath("InputSuppressionsLoaderNone.xml"));
final FilterSet fc2 = new FilterSet();
assertWithMessage("Suppressions were not loaded").that(fc.getFilters()).isEqualTo(fc2.getFilters());
}
use of com.puppycrawl.tools.checkstyle.api.FilterSet in project checkstyle by checkstyle.
the class SuppressionsLoaderTest method testSettingModuleId.
@Test
public void testSettingModuleId() throws Exception {
final FilterSet fc = SuppressionsLoader.loadSuppressions(getPath("InputSuppressionsLoaderWithId.xml"));
final SuppressFilterElement suppressElement = (SuppressFilterElement) fc.getFilters().toArray()[0];
final String id = TestUtil.getInternalState(suppressElement, "moduleId");
assertWithMessage("Id has to be defined").that(id).isEqualTo("someId");
}
use of com.puppycrawl.tools.checkstyle.api.FilterSet in project checkstyle by checkstyle.
the class SuppressionsLoaderTest method testLoadFromUrl.
@Test
public void testLoadFromUrl() throws Exception {
final String[] urlCandidates = { "https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/site/resources/" + "files/suppressions_none.xml", "https://checkstyle.org/files/suppressions_none.xml" };
FilterSet actualFilterSet = null;
for (String url : urlCandidates) {
actualFilterSet = loadFilterSet(url);
if (actualFilterSet != null) {
break;
}
}
assumeTrue(actualFilterSet != null, "No Internet connection.");
final FilterSet expectedFilterSet = new FilterSet();
assertWithMessage("Failed to load from url").that(actualFilterSet.getFilters()).isEqualTo(expectedFilterSet.getFilters());
}
use of com.puppycrawl.tools.checkstyle.api.FilterSet in project checkstyle by checkstyle.
the class SuppressionsLoaderTest method testMultipleSuppression.
@Test
public void testMultipleSuppression() throws Exception {
final FilterSet fc = SuppressionsLoader.loadSuppressions(getPath("InputSuppressionsLoaderMultiple.xml"));
final FilterSet fc2 = new FilterSet();
final SuppressFilterElement se0 = new SuppressFilterElement("file0", "check0", null, null, null, null);
fc2.addFilter(se0);
final SuppressFilterElement se1 = new SuppressFilterElement("file1", "check1", null, null, "1,2-3", null);
fc2.addFilter(se1);
final SuppressFilterElement se2 = new SuppressFilterElement("file2", "check2", null, null, null, "1,2-3");
fc2.addFilter(se2);
final SuppressFilterElement se3 = new SuppressFilterElement("file3", "check3", null, null, "1,2-3", "1,2-3");
fc2.addFilter(se3);
final SuppressFilterElement se4 = new SuppressFilterElement(null, null, "message0", null, null, null);
fc2.addFilter(se4);
assertWithMessage("Multiple suppressions were loaded incorrectly").that(fc.getFilters()).isEqualTo(fc2.getFilters());
}
Aggregations