Buggy code:
@ RunWith ( Enclosed . class ) public class IdStrategyTest { private static final String idKey = "myId" ; public static class DefaultIdStrategyTest extends AbstractGremlinTest { public DefaultIdStrategyTest ( ) { } @ Test @ FeatureRequirementSet ( Package . VERTICES_ONLY ) public void shouldInjectAnIdAndReturnBySpecifiedIdForVertex ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) public void shouldInjectAnIdAndReturnBySpecifiedIdForEdge ( ) { } @ Test @ FeatureRequirementSet ( Package . VERTICES_ONLY ) public void shouldCreateAnIdAndReturnByCreatedIdForVertex ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) public void shouldCreateAnIdAndReturnByCreatedIdForEdge ( ) { } } public static class VertexIdMakerIdStrategyTest extends AbstractGremlinTest { public VertexIdMakerIdStrategyTest ( ) { } @ Test @ FeatureRequirementSet ( Package . VERTICES_ONLY ) public void shouldCreateAnIdAndReturnByCreatedId ( ) { } } public static class EdgeIdMakerIdStrategyTest extends AbstractGremlinTest { public EdgeIdMakerIdStrategyTest ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) public void shouldCreateAnIdAndReturnByCreatedId ( ) { } } public static class VertexIdNotSupportedIdStrategyTest extends AbstractGremlinTest { public VertexIdNotSupportedIdStrategyTest ( ) { } @ Test @ FeatureRequirementSet ( Package . VERTICES_ONLY ) @ FeatureRequirement ( featureClass = VertexFeatures . class , feature = FEATURE_USER_SUPPLIED_IDS ) public void shouldInjectAnIdAndReturnBySpecifiedId ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) @ FeatureRequirement ( featureClass = VertexFeatures . class , feature = FEATURE_USER_SUPPLIED_IDS ) public void shouldAllowDirectSettingOfIdField ( ) { final IdStrategy strategy = ( ( IdStrategy ) ( ( ( StrategyGraph ) ( graph ) ) . getStrategy ( ) ) ) ; final Object o = GraphManager . getGraphProvider ( ) . convertId ( "1" ) ; final Vertex v = graph . addVertex ( id , o , "something" , "else" , strategy . getIdKey ( ) , "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=true" ) ; tryCommit ( graph , ( c ) -> { assertNotNull ( v ) ; assertEquals ( o , v . id ( ) ) ; assertEquals ( "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=true" , v . property ( strategy . getIdKey ( ) ) . value ( ) ) ; assertEquals ( "else" , v . property ( "something" ) . value ( ) ) ; final Vertex found = g . V ( o ) . next ( ) ; assertEquals ( o , found . id ( ) ) ; assertEquals ( "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=true" , found . property ( strategy . getIdKey ( ) ) . value ( ) ) ; assertEquals ( "else" , found . property ( "something" ) . value ( ) ) ; } ) ; try { v . addEdge ( "self" , v , id , o , "something" , "else" , strategy . getIdKey ( ) , "this<seq2seq4repair_space>should<seq2seq4repair_space>toss<seq2seq4repair_space>and<seq2seq4repair_space>exception<seq2seq4repair_space>as<seq2seq4repair_space>supportsVertexId=false" ) ; fail ( "An<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>tossed<seq2seq4repair_space>here<seq2seq4repair_space>because<seq2seq4repair_space>supportsEdgeId=true" ) ; } catch ( IllegalArgumentException iae ) { assertNotNull ( iae ) ; } try { final Edge e = v . addEdge ( "self" , v , id , o , "something" , "else" ) ; e . property ( strategy . getIdKey ( ) , "this<seq2seq4repair_space>should<seq2seq4repair_space>toss<seq2seq4repair_space>and<seq2seq4repair_space>exception<seq2seq4repair_space>as<seq2seq4repair_space>supportsVertexId=false" ) ; fail ( "An<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>tossed<seq2seq4repair_space>here<seq2seq4repair_space>because<seq2seq4repair_space>supportsEdgeId=true" ) ; } catch ( IllegalArgumentException iae ) { assertNotNull ( iae ) ; } } } public static class EdgeIdNotSupportedIdStrategyTest extends AbstractGremlinTest { public EdgeIdNotSupportedIdStrategyTest ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) @ FeatureRequirement ( featureClass = EdgeFeatures . class , feature = EdgeFeatures . FEATURE_USER_SUPPLIED_IDS ) public void shouldInjectAnIdAndReturnBySpecifiedId ( ) { } @ Test @ FeatureRequirementSet ( Package . SIMPLE ) @ FeatureRequirement ( featureClass = EdgeFeatures . class , feature = EdgeFeatures . FEATURE_USER_SUPPLIED_IDS ) public void shouldAllowDirectSettingOfIdField ( ) { final IdStrategy strategy = ( ( IdStrategy ) ( ( ( StrategyGraph ) ( graph ) ) . getStrategy ( ) ) ) ; final Vertex v = graph . addVertex ( id , "test" , "something" , "else" ) ; final Edge e = v . addEdge ( "self" , v , id , "edge-id" , "try" , "this" , strategy . getIdKey ( ) , "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=false" ) ; tryCommit ( graph , ( c ) -> { assertNotNull ( e ) ; assertEquals ( "edge-id" , e . id ( ) ) ; assertEquals ( "this" , e . property ( "try" ) . value ( ) ) ; assertEquals ( "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=false" , e . property ( strategy . getIdKey ( ) ) . value ( ) ) ; <START_BUG> final Edge found = g . E ( "edge-id" ) . next ( ) ; <END_BUG> assertEquals ( "edge-id" , found . id ( ) ) ; assertEquals ( "this" , found . property ( "try" ) . value ( ) ) ; assertEquals ( "should<seq2seq4repair_space>be<seq2seq4repair_space>ok<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>this<seq2seq4repair_space>as<seq2seq4repair_space>supportsEdgeId=false" , found . property ( strategy . getIdKey ( ) ) . value ( ) ) ; } ) ; try { graph . addVertex ( id , "test" , "something" , "else" , strategy . getIdKey ( ) , "this<seq2seq4repair_space>should<seq2seq4repair_space>toss<seq2seq4repair_space>and<seq2seq4repair_space>exception<seq2seq4repair_space>as<seq2seq4repair_space>supportsVertexId=true" ) ; fail ( "An<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>tossed<seq2seq4repair_space>here<seq2seq4repair_space>because<seq2seq4repair_space>supportsVertexId=true" ) ; } catch ( IllegalArgumentException iae ) { assertNotNull ( iae ) ; } try { v . property ( strategy . getIdKey ( ) , "this<seq2seq4repair_space>should<seq2seq4repair_space>toss<seq2seq4repair_space>and<seq2seq4repair_space>exception<seq2seq4repair_space>as<seq2seq4repair_space>supportsVertexId=true" ) ; fail ( "An<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>tossed<seq2seq4repair_space>here<seq2seq4repair_space>because<seq2seq4repair_space>supportsVertexId=true" ) ; } catch ( IllegalArgumentException iae ) { assertNotNull ( iae ) ; } } } }

Fix:
final Edge found = graph . edges ( "edge-id" ) . next ( ) ;