@Test
public void checkGuard()
        throws Exception {

    Object key1 = ScopeProvider.createScope(null);
    Object key2 = ScopeProvider.createScope(null);
    IScope scope1 = ScopeProvider.getScope(key1);
    IScope scope2 = ScopeProvider.getScope(key2);
    assertNotSame(scope1, scope2);
    ScopeProvider.setCurrentScope(scope1);
    ScopeGuard guard = new ScopeGuard(key2);
    assertEquals(scope2, ScopeProvider.getCurrentScope());
    guard.close();
    assertEquals(scope1, ScopeProvider.getCurrentScope());
}