@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"); }
@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"); }
@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(); } }