@Test(expected = IllegalArgumentException.class) public void shouldNotBeAbleToExitTheWrongScope() { final ContextScope scope = RoboGuice.getOrCreateBaseApplicationInjector(Robolectric.application) .getInstance(ContextScope.class); final Activity a = Robolectric.buildActivity(A.class).get(); final Activity b = Robolectric.buildActivity(B.class).get(); scope.enter(a); scope.enter(b); scope.exit(a); }
@Test public void shouldBeAbleToOpenMultipleScopes() { final ContextScope scope = RoboGuice.getOrCreateBaseApplicationInjector(Robolectric.application) .getInstance(ContextScope.class); final Activity a = Robolectric.buildActivity(A.class).get(); final Activity b = Robolectric.buildActivity(B.class).get(); scope.enter(a); scope.enter(b); scope.exit(b); scope.exit(a); }