use of com.hazelcast.jet.impl.connector.ReadFilesPTest.TestPerson in project hazelcast by hazelcast.
the class WriteFilePTest method test_JsonFile.
@Test
public void test_JsonFile() throws IOException {
// Given
Pipeline p = Pipeline.create();
TestPerson testPerson = new TestPerson("foo", 5, true);
p.readFrom(TestSources.items(testPerson)).writeTo(Sinks.json(directory.toString()));
// When
instance().getJet().newJob(p).join();
// Then
List<String> lines = Files.list(directory).flatMap(file -> uncheckCall(() -> Files.readAllLines(file).stream())).collect(Collectors.toList());
assertEquals(1, lines.size());
TestPerson actual = JSON.std.beanFrom(TestPerson.class, lines.get(0));
assertEquals(testPerson, actual);
}
Aggregations