@Test @LoadGraphWith(LoadGraphWith.GraphData.MODERN) public void shouldReadWritePropertyGraphSON() throws Exception { try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { final GraphWriter writer = writerMaker.apply(graph); final Property p = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight"); writer.writeProperty(os, p); final AtomicBoolean called = new AtomicBoolean(false); final GraphReader reader = readerMaker.apply(graph); try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) { reader.readProperty(bais, propertyAttachable -> { assertEquals(p.value(), propertyAttachable.get().value()); assertEquals(p.key(), propertyAttachable.get().key()); called.set(true); return propertyAttachable.get(); }); } assertTrue(called.get()); } } }
@Test @LoadGraphWith(LoadGraphWith.GraphData.MODERN) public void shouldReadWritePropertyGraphSON() throws Exception { try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { final GraphWriter writer = writerMaker.apply(graph); final Property p = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight"); writer.writeProperty(os, p); final AtomicBoolean called = new AtomicBoolean(false); final GraphReader reader = readerMaker.apply(graph); try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) { reader.readProperty(bais, propertyAttachable -> { assertEquals(p.value(), propertyAttachable.get().value()); assertEquals(p.key(), propertyAttachable.get().key()); called.set(true); return propertyAttachable.get(); }); } assertTrue(called.get()); } } }