Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -3,3 +3,6 @@ target/ ...@@ -3,3 +3,6 @@ target/
.project .project
.settings .settings
site site
.idea/
ferma.iml
...@@ -362,7 +362,7 @@ public class AdjacencyMethodHandler extends AbstractMethodHandler { ...@@ -362,7 +362,7 @@ public class AdjacencyMethodHandler extends AbstractMethodHandler {
default: default:
throw new IllegalStateException("Direction not recognized."); throw new IllegalStateException("Direction not recognized.");
} }
}).next(VertexFrame.class); }).nextOrDefault(VertexFrame.class, null);
} }
} }
......
...@@ -323,6 +323,26 @@ public class AdjacencyMethodHandlerTest { ...@@ -323,6 +323,26 @@ public class AdjacencyMethodHandlerTest {
Assert.assertTrue(child instanceof GodExtended); 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 @Test
public void testAddSonDefault() { public void testAddSonDefault() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment