Context { public void put(String key, String value) { Preconditions.checkNotNull(key, "key is null"); Preconditions.checkNotNull(value, "value is null"); Preconditions.checkArgument(key.indexOf('/') == -1, "key must not contain a slash"); Preconditions.checkArgument(!children.containsKey(key), "key identifies a path, put operation not allowed"); values.put(key, value); }  Set<String> getKeys(); String get(String key); void put(String key, String value); Map<String, Context> getChildren(); Context getChild(String name); Context createChild(String name); void remove(String nameOrKey); void setId(String id); String getId(); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void testPutKeyWithSlash_shouldThrowIllegalArgumentException() throws Exception { context.put("with/slash", ""); }
@Test(expected = NullPointerException.class) public void testNullKey_shouldThrowNullPointerException() throws Exception { context.put(null, ""); }
@Test(expected = NullPointerException.class) public void testNullValue_shouldThrowNullPointerException() throws Exception { context.put("a", null); }