net.sourceforge.pmd.test.schema.RuleTestCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pmd-test-schema Show documentation
Show all versions of pmd-test-schema Show documentation
Parser for the XML test description format. The module has no dependency
on junit or other test-only dependencies.
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.test.schema;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* Collection of individual rule tests. Each test contains a copy of the
* rule.
*
* @author Clément Fournier
*/
public class RuleTestCollection {
private final List tests = new ArrayList<>();
public void addTest(RuleTestDescriptor descriptor) {
tests.add(Objects.requireNonNull(descriptor));
}
public List getTests() {
return Collections.unmodifiableList(tests);
}
/**
* Returns the last test of the collection which is focused.
*/
public RuleTestDescriptor getFocusedTestOrNull() {
RuleTestDescriptor focused = null;
for (RuleTestDescriptor test : tests) {
if (test.isFocused()) {
focused = test;
}
}
return focused;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy