コード例 #1
0
 @Test
 public void shouldReturnTrueIfNodePropertyRemoved() throws Exception {
   Map<String, Object> properties = new HashMap<String, Object>();
   properties.put("foo", "bar");
   properties.put("number", 15);
   long nodeId = createNode(properties);
   actions.removeNodeProperty(nodeId, "foo");
 }
コード例 #2
0
 @Test(expected = NoSuchPropertyException.class)
 public void shouldReturnFalseIfNodePropertyNotRemoved() throws Exception {
   Map<String, Object> properties = new HashMap<String, Object>();
   properties.put("foo", "bar");
   properties.put("number", 15);
   long nodeId = createNode(properties);
   actions.removeNodeProperty(nodeId, "baz");
 }
コード例 #3
0
  @Test
  public void shouldBeAbleToRemoveNodeProperty() throws Exception {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("foo", "bar");
    properties.put("number", 15);
    long nodeId = createNode(properties);
    actions.removeNodeProperty(nodeId, "foo");

    Transaction tx = database.getGraph().beginTx();
    try {
      Node node = database.getGraph().getNodeById(nodeId);
      assertEquals(15, node.getProperty("number"));
      assertEquals(false, node.hasProperty("foo"));
      tx.success();
    } finally {
      tx.finish();
    }
  }