### Question:
ServiceRequestScopeImpl implements Scope { @Override public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped) { return () -> { validateInScope(); T current = (T) seededClasses.get().get(key); if (current == null) { current = unscoped.get(); if (Scopes.isCircularProxy(current)) { return current; } seededClasses.get().put(key, current); } return current; }; }  @Override Provider<T> scope(Key<T> key, Provider<T> unscoped); @Override String toString(); void seed(Key<T> key, T seed); boolean isInsideScope(); void enter(); void exit();  }### Answer:
@Test public void testProviderWithUnseededObject() { when(unscopedProvider.get()).thenReturn(seed); executeInsideScope(() -> { assertSame(seed, scope.scope(key, unscopedProvider).get()); verify(unscopedProvider, times(1)).get(); }); }
@Test public void testProviderWithUnseededObjectCachesResolvedObject() { when(unscopedProvider.get()).thenReturn(seed); executeInsideScope(() -> { assertSame(scope.scope(key, unscopedProvider).get(), scope.scope(key, unscopedProvider).get()); verify(unscopedProvider, times(1)).get(); }); }
@Test(expected = OutOfScopeException.class) public void testProviderNotEnteredScope() { scope.scope(key, unscopedProvider).get(); }