@Test
    public void g_call_start_lambda() {
        final String serviceName = "tinker.random";

        final BiFunction<ServiceCallContext, Map, Iterator<Integer>> lambda = (ctx, map) -> {
            final int numValues = (int) map.getOrDefault("numValues", 5);
            final boolean random = (boolean) map.getOrDefault("random", false);
            final Long seed = (Long) map.get("seed");
            final List<Integer> values = new ArrayList<>(numValues);
            final Random r = seed != null ? new Random(seed) : new Random();
            for (int i = 0; i < numValues; i++) {
                if (random)
                    values.add(r.nextInt(1000));
                else
                    // use fixed values for testing
                    values.add(i);
            }
            return values.iterator();
        };

        graph.getServiceRegistry().<Object,Integer>registerLambdaService(serviceName).addStartLambda(lambda);

        /*
         * Use defaults.
         */
        assertEquals("[0,1,2,3,4]", toResultString(

            g.call(serviceName)

        ));

        /*
         * Invoke via Map (static parameters).
         */
        assertEquals("[0,1,2,3,4,5,6,7,8,9]", toResultString(

            g.call(serviceName, asMap("numValues", 10))

        ));

        /*
         * Invoke via Traversal<Map> (dynamic parameters).
         */
        assertEquals("[0,1,2,3,4,5,6,7]", toResultString(

            g.withSideEffect("x", asMap("numValues", 8))
                .call(serviceName, __.select("x"))

        ));

        /*
         * Invoke via .with(String, Traversal) (dynamic parameters).
         */
        checkResult(100l,

                g.call(serviceName)
                    .with("random", true)
                    .with("numValues", 100)
                    .with("seed", __.V().constant(17537423l))
                        .count()

        );
    }
Demonstrates registration and usage of a Starting lambda service. Start services take no input and are run
via GraphTraversalSource. Text search above is another example of a Start service.
tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphServiceTest.java