### Question:
GraphUtil { static public <T> Optional<T> getProperty(PropertyContainer container, String property, Class<T> type) { Optional<T> value = Optional.<T>empty(); if (container.hasProperty(property)) { value = Optional.<T> of(type.cast(container.getProperty(property))); } return value; }  static void addProperty(PropertyContainer container, String property, Object value); static Optional<T> getProperty(PropertyContainer container, String property,
      Class<T> type); static Collection<T> getProperties(PropertyContainer container, String property,
      Class<T> type); static Iterable<Relationship> getRelationships(final Node a, final Node b,
      RelationshipType type, final boolean directed); static Iterable<Relationship> getRelationships(final Node a, final Node b,
      RelationshipType type); static boolean ignoreProperty(Object value);  }### Answer:
@Test public void testGetProperty() { assertThat(GraphUtil.getProperty(node, "foo", String.class), is(Optional.of("bar"))); assertThat(GraphUtil.getProperty(node, "fizz", Integer.class), is(Optional.of(1))); }
@Test public void testUnknownProperty() { assertThat(GraphUtil.getProperty(node, "nothing", String.class), is(Optional.<String>empty())); }
@Test(expected = ClassCastException.class) public void testGetWrongPropertyType() { GraphUtil.getProperty(node, "foo", Float.class); }