import static org.mockito.Mockito.mock;
import com.google.common.base.Preconditions;
-import java.io.IOException;
import java.io.InputStream;
-import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
@RunWith(value = Parameterized.class)
public class FilterContentValidatorTest {
private FilterContentValidator validator;
@Parameterized.Parameters
- public static Collection<Object[]> data() throws IOException, SAXException, URISyntaxException, InitializationError {
+ public static Collection<Object[]> data() throws Exception {
final List<Object[]> result = new ArrayList<>();
final Path path = Paths.get(FilterContentValidatorTest.class.getResource("/filter/expected.txt").toURI());
final List<String> expected = Files.readAllLines(path);
throw new InitializationError("Number of lines in results file must be same as test case count");
}
for (int i = 1; i <= TEST_CASE_COUNT; i++) {
- final Document document = XmlUtil.readXmlToDocument(FilterContentValidatorTest.class.getResourceAsStream("/filter/f" + i + ".xml"));
- result.add(new Object[]{document, expected.get(i-1)});
+ final Document document = XmlUtil.readXmlToDocument(FilterContentValidatorTest.class.getResourceAsStream(
+ "/filter/f" + i + ".xml"));
+ result.add(new Object[]{document, expected.get(i - 1)});
}
return result;
}
validator = new FilterContentValidator(currentContext);
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Test
public void testValidate() throws Exception {
if (expected.startsWith("success")) {
return prev;
}
- private static QName createNodeQName(final QName prev, final String qNameString) {
- final QName qName = QName.create(qNameString);
+ private static QName createNodeQName(final QName prev, final String input) {
+ final QName qName = QName.create(input);
if (qName.getModule().getNamespace() != null) {
return qName;
} else {
- return QName.create(Preconditions.checkNotNull(prev), qNameString);
+ return QName.create(Preconditions.checkNotNull(prev), input);
}
}
}