use of io.confluent.ksql.test.model.TestFileContext in project ksql by confluentinc.
the class JsonTestLoader method buildTests.
private static <TFT extends TestFile<T>, T extends Test> Stream<T> buildTests(final Path testPath, final Class<TFT> testFileType) {
try (InputStream stream = JsonTestLoader.class.getClassLoader().getResourceAsStream(testPath.toString());
BufferedReader reader = new BufferedReader(new InputStreamReader(throwNotFoundIfNull(stream, testPath), UTF_8))) {
final List<String> lines = reader.lines().collect(Collectors.toList());
final String content = lines.stream().collect(Collectors.joining(System.lineSeparator()));
final TFT testFile = OBJECT_MAPPER.readValue(content, testFileType);
return testFile.buildTests(new TestFileContext(testPath, lines));
} catch (final Exception e) {
throw new RuntimeException("Unable to load test at path " + testPath, e);
}
}
Aggregations