DefaultContext extends BaseParamContext { public final DefaultContext with(String key, Object value) { return with(key, value, false); } DefaultContext(Object... args);  DefaultContext(); final DefaultContext with(String key, Object value); final DefaultContext with(String key, Object value, boolean allowOverwrite); final DefaultContext set(Object value); Object get(String key); @SuppressWarnings("unchecked") T get(String key, Class<T> targetClass); String getString(String key); @SuppressWarnings("unchecked") T get(Class<T> clazz); void setLocale(Locale locale); DefaultContext withLevelValues(String... levelValues); DefaultContext withLevelValues(Object... levelValues); @Override String toString();  }
@Test public void shouldPutValueIntoTheContextUnderGivenName() { DefaultContext context = new DefaultContext(); context.with("TEST", "A"); assertThat(context).hasValue("TEST", "A"); }
@Test public void shouldThrowExceptionIfhereIsAlreadyValueRegisteredUnderTheSameKey() { DefaultContext context = new DefaultContext(); context.with("TEST", "B"); try { context.with("TEST", "A"); fail(); } catch(DuplicateContextItemException exception) { } }
@Test public void shouldAllowOnOverwritingValuesInContextWhenCallingMethodWithOverwriteFlag() { DefaultContext context = new DefaultContext(); context.with("TEST", "B"); context.with("TEST", "A", true); assertThat(context).hasValue("TEST", "A"); }