Commit 480a517d authored by Jess Sightler's avatar Jess Sightler
Browse files

Updated to not throw when returning a single item (this can just return null...

Updated to not throw when returning a single item (this can just return null as frames did) and added a test
parent 5bfcf881
......@@ -3,3 +3,6 @@ target/
.project
.settings
site
.idea/
ferma.iml
......@@ -362,7 +362,7 @@ public class AdjacencyMethodHandler extends AbstractMethodHandler {
default:
throw new IllegalStateException("Direction not recognized.");
}
}).next(VertexFrame.class);
}).nextOrDefault(VertexFrame.class, null);
}
}
......
......@@ -323,6 +323,26 @@ public class AdjacencyMethodHandlerTest {
Assert.assertTrue(child instanceof GodExtended);
}
@Test
public void testSetSonNull() {
GodGraphLoader.load(godGraph);
final FramedGraph framedGraph = new DelegatingFramedGraph(godGraph, TEST_TYPES);
final List<? extends God> gods = framedGraph.traverse(
input -> input.V().has("name", "jupiter")).toList(God.class);
final God father = gods.iterator().next();
Assert.assertTrue(father != null);
final VertexFrame fatherVertex = father;
Assert.assertEquals(fatherVertex.getProperty("name"), "jupiter");
father.setSon(null);
final God sonNull = father.getSon();
Assert.assertNull(sonNull);
}
@Test
public void testAddSonDefault() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment