@Test public void testGetOrDefault() { final Context instance = EmptyContext.getInstance(); final Key<String> key = Key.of(randomUUID().toString(), String.class); final String expected = randomUUID().toString(); final String actual = instance.getOrDefault(key, expected); assertEquals(expected, actual); }
@Override public <T> T getOrDefault(final Key<T> key, final T defaultValue) { assertNotNull(key, "Key must not null"); return defaultValue; }
EmptyContext implements Context { @Override public <T> T getOrDefault(final Key<T> key, final T defaultValue) { assertNotNull(key, "Key must not null"); return defaultValue; } }
EmptyContext implements Context { @Override public <T> T getOrDefault(final Key<T> key, final T defaultValue) { assertNotNull(key, "Key must not null"); return defaultValue; } EmptyContext(); }
EmptyContext implements Context { @Override public <T> T getOrDefault(final Key<T> key, final T defaultValue) { assertNotNull(key, "Key must not null"); return defaultValue; } EmptyContext(); static Context getInstance(); @Override Context withValue(final Key<T> key, final T value); @Override T get(final Key<T> key); @Override T getOrDefault(final Key<T> key, final T defaultValue); @Override Context withScope(final String scope); @Override String getScope(); }
EmptyContext implements Context { @Override public <T> T getOrDefault(final Key<T> key, final T defaultValue) { assertNotNull(key, "Key must not null"); return defaultValue; } EmptyContext(); static Context getInstance(); @Override Context withValue(final Key<T> key, final T value); @Override T get(final Key<T> key); @Override T getOrDefault(final Key<T> key, final T defaultValue); @Override Context withScope(final String scope); @Override String getScope();  }