@Test
public void shouldCorrectlyDetermineScopeFromThread() throws Exception
{

    ContainerClassLoader loader = ContainerClassLoader.newInstance("Test", null, System.getProperties());
    Thread               thread = Thread.currentThread();
    ClassLoader          saved  = thread.getContextClassLoader();
    thread.setContextClassLoader(loader);
    try
    {
        assertThat(loader.getContainerScope(), sameInstance(Container.getContainerScope()));
    }
    finally
    {
        thread.setContextClassLoader(saved);
    }
}