Bytecode implements Cloneable, Serializable { public List<Instruction> getSourceInstructions() { return this.sourceInstructions; }  void addSource(final String sourceName, final Object... arguments); void addStep(final String stepName, final Object... arguments); List<Instruction> getSourceInstructions(); List<Instruction> getStepInstructions(); Iterable<Instruction> getInstructions(); Map<String, Object> getBindings(); boolean isEmpty(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @Override Bytecode clone();  }
@Test public void shouldConvertStrategies() { final GraphTraversalSource g = EmptyGraph.instance().traversal(); Bytecode bytecode = g.withStrategies(ReadOnlyStrategy.instance()).getBytecode(); assertEquals(ReadOnlyStrategy.instance(), bytecode.getSourceInstructions().get(0).getArguments()[0]); bytecode = g.withStrategies(SubgraphStrategy.build().edges(__.hasLabel("knows")).create()).getBytecode(); assertEquals(SubgraphStrategy.build().edges(__.hasLabel("knows")).create().getEdgeCriterion().asAdmin().getBytecode(), ((SubgraphStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getEdgeCriterion().asAdmin().getBytecode()); }
@Test public void shouldConvertComputer() { final GraphTraversalSource g = EmptyGraph.instance().traversal(); Bytecode bytecode = g.withComputer(Computer.compute().workers(10)).getBytecode(); assertEquals(VertexProgramStrategy.build().create(), bytecode.getSourceInstructions().get(0).getArguments()[0]); assertEquals(VertexProgramStrategy.build().workers(10).create().getConfiguration().getInt(VertexProgramStrategy.WORKERS), ((VertexProgramStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getConfiguration().getInt(VertexProgramStrategy.WORKERS)); }