@Test
public void testScopeWithTwoInternalTasks() throws Exception {
final RequestScope requestScope = new RequestScope();
assertNull(requestScope.suspendCurrent());
final TestProvider inhab = new TestProvider("a");
Instance instance = requestScope.runInScope(new Callable<Instance>() {
@Override
public Instance call() throws Exception {
final Instance internalInstance = requestScope.suspendCurrent();
Instance anotherInstance = requestScope.runInScope(new Callable<Instance>() {
@Override
public Instance call() throws Exception {
final Instance currentInstance = requestScope.suspendCurrent();
assertTrue(!currentInstance.equals(internalInstance));
currentInstance.put(inhab, "1");
return currentInstance;
}
});
assertTrue(!anotherInstance.equals(internalInstance));
assertEquals("1", anotherInstance.get(inhab));