Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.tinkerpop.gremlin.structure;
import com.tinkerpop.gremlin.AbstractGremlinTest;
import com.tinkerpop.gremlin.GraphManager;
import com.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures;
import com.tinkerpop.gremlin.structure.Graph.Features.PropertyFeatures;
import com.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatures;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.tinkerpop.gremlin.structure.Graph.Features.DataTypeFeatures.FEATURE_STRING_VALUES;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeThat;
/**
* Blueprints Test Suite for {@link com.tinkerpop.gremlin.structure.Property} operations.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
@RunWith(Enclosed.class)
public class PropertyTest {
/**
* Basic tests for the {@link com.tinkerpop.gremlin.structure.Property} class.
*/
public static class BasicPropertyTest extends AbstractGremlinTest {
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldHaveStandardStringRepresentation() {
final Vertex v = g.addVertex("name", "marko");
final Property p = v.property("name");
assertEquals(StringFactory.propertyString(p), p.toString());
}
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldReturnEmptyPropertyIfKeyNonExistent() {
final Vertex v = g.addVertex("name", "marko");
tryCommit(g, (graph) -> {
final Vertex v1 = g.v(v.id());
final Property p = v1.property("nonexistent-key");
assertEquals(Property.empty(), p);
});
}
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldAllowRemovalWhenAlreadyRemoved() {
final Vertex v = g.addVertex("name", "marko");
tryCommit(g);
final Vertex v1 = g.v(v.id());
try {
final Property p = v1.property("name");
p.remove();
p.remove();
} catch (Exception ex) {
fail("Removing a property that was already removed should not throw an exception");
}
}
}
/**
* Tests for feature support on {@link com.tinkerpop.gremlin.structure.Property}. The tests validate if {@link com.tinkerpop.gremlin.structure.Graph.Features.PropertyFeatures}
* should be turned on or off and if the enabled features are properly supported by the implementation. Note that
* these tests are run in a separate test class as they are "parameterized" tests.
*/
@RunWith(Parameterized.class)
public static class PropertyFeatureSupportTest extends AbstractGremlinTest {
private static final Map testMap = new HashMap() {{
put("testString", "try");
put("testInteger", 123);
}};
private static final ArrayList