@Test public void no_properties_by_default() { assertThat(beanVertex.getProperty("color")).isNull(); assertThat(beanVertex.getProperty("code")).isNull(); assertThat(beanVertex.getProperty("alive")).isNull(); assertThat(beanVertex.getPropertyKeys()).isEmpty(); }
@Test public void should_set_properties() { beanVertex.setProperty("color", "red"); beanVertex.setProperty("code", 123); beanVertex.setProperty("alive", true); assertThat(beanVertex.getProperty("color")).isEqualTo("red"); assertThat(beanVertex.getProperty("code")).isEqualTo(123); assertThat(beanVertex.getProperty("alive")).isEqualTo(true); assertThat(beanVertex.getPropertyKeys()).containsOnly("color", "code", "alive"); }
@Test public void should_remove_property() { beanVertex.setProperty("color", "red"); beanVertex.setProperty("code", 123); beanVertex.setProperty("alive", true); beanVertex.removeProperty("color"); beanVertex.removeProperty("code"); beanVertex.removeProperty("alive"); beanVertex.removeProperty("other"); assertThat(beanVertex.getProperty("color")).isNull(); assertThat(beanVertex.getProperty("code")).isNull(); assertThat(beanVertex.getProperty("alive")).isNull(); assertThat(beanVertex.getPropertyKeys()).isEmpty(); }
@Test public void should_unset_properties_with_null_values() { beanVertex.setProperty("color", "red"); beanVertex.setProperty("code", 123); beanVertex.setProperty("alive", true); beanVertex.setProperty("color", null); beanVertex.setProperty("code", null); beanVertex.setProperty("alive", null); beanVertex.setProperty("other", null); assertThat(beanVertex.getProperty("color")).isNull(); assertThat(beanVertex.getProperty("code")).isNull(); assertThat(beanVertex.getProperty("alive")).isNull(); assertThat(beanVertex.getPropertyKeys()).isEmpty(); }