@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception { try { final Date id = new Date(); graph.addVertex(T.id, id); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception if (!graph.features().vertex().willAllowId(id)) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_ANY_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeUuid() throws Exception { final UUID id = UUID.randomUUID(); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeString() throws Exception { final String id = "this-is-a-valid-id"; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
throw Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported();
throw Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported();
boolean userProvidedId = true; if (id != null && id instanceof String == false) { throw Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported();
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception { try { final Date id = new Date(); graph.addVertex(T.id, id); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception if (!graph.features().vertex().willAllowId(id)) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_ANY_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeUuid() throws Exception { final UUID id = UUID.randomUUID(); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericLong() throws Exception { final long id = 123456l; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericInt() throws Exception { final int id = 123456; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeString() throws Exception { final String id = "this-is-a-valid-id"; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericLong() throws Exception { final long id = 123456l; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericInt() throws Exception { final int id = 123456; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }