@Test
    @LoadGraphWith(MODERN)
    public void shouldRespectMaxDistance() throws Exception {
        final ComputerResult result = graph.compute(graphProvider.getGraphComputer(graph).getClass()).
                program(ShortestPathVertexProgram.build()
                        .source(__.has("name", "marko"))
                        .maxDistance(1).create(graph)).submit().get();
        assertTrue(result.memory().exists(ShortestPathVertexProgram.SHORTEST_PATHS));
        final List<Path> shortestPaths = result.memory().get(ShortestPathVertexProgram.SHORTEST_PATHS);
        final List<Path> expected = Arrays.stream(ALL_SHORTEST_PATHS)
                .filter(p -> p[0].equals("marko") && p.length <= 2).map(helper::makePath).collect(Collectors.toList());
        helper.checkResults(expected, shortestPaths);
    }
@author Daniel Kuppitz (http://gremlin.guru)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/search/path/ShortestPathVertexProgramTest.java