BdioObject extends AbstractMap<String, Object> { @Override public final Object put(String key, @Nullable Object value) { Objects.requireNonNull(key, "key must not be null"); return value != null ? data.put(key, value) : data.remove(key); } protected  BdioObject(String id, Bdio.Class bdioClass); protected  BdioObject(Bdio.Class bdioClass);   BdioObject(Map<String, Object> initialValues);   BdioObject(); static String randomId(); @Override final Set<Entry<String, Object>> entrySet(); @Override final Set<String> keySet(); @Override final Object get(@Nullable Object key); @Override final Object put(String key, @Nullable Object value); @Nullable final String id();  }
@Test public void regularMap() { BdioObject bdioObject = new BdioObject(); bdioObject.put("test1", "foo"); assertThat(bdioObject).containsEntry("test1", "foo"); bdioObject.put("test1", "bar"); assertThat(bdioObject).containsEntry("test1", "bar"); bdioObject.put("X:Y:Z", 1L); assertThat(bdioObject).containsEntry("X:Y:Z", 1L); }
@Test(expected = NullPointerException.class) public void putNullKeyFails() { new BdioObject().put(null, "foo"); }
@Test public void putNullValueIsRemove() { BdioObject bdioObject = new BdioObject(); bdioObject.put("test1", "foo"); assertThat(bdioObject).containsKey("test1"); bdioObject.put("test1", null); assertThat(bdioObject).doesNotContainKey("test1"); }