Package com.mycila.testing.core.api

Examples of com.mycila.testing.core.api.TestContext


        }
    }

    public static TestContext context(Object testInstance) {
        notNull("Test instance", testInstance);
        TestContext context = CONTEXTS.get(testInstance);
        if (context == null) {
            throw new MycilaTestingException("No Global Test Context available for test %s#%s", testInstance.getClass().getName(), testInstance.hashCode());
        }
        return context;
    }
View Full Code Here


    }

    @Test
    public void test_context() throws Exception {
        Introspector introspector = new Introspector(this);
        TestContext context = mock(TestContext.class);
        when(context.introspector()).thenReturn(introspector);

        assertThrow(IllegalStateException.class).containingMessage("No Global Test Context available for test com.mycila.testing.core.MycilaTest#").whenRunning(new Code() {
            public void run() throws Throwable {
                Mycila.context(MycilaTest.this);
            }
View Full Code Here

    }

    @Test
    public void test_execution() throws Exception {
        Introspector introspector = new Introspector(this);
        TestContext context = mock(TestContext.class);
        final Execution execution = mock(Execution.class);
        when(context.introspector()).thenReturn(introspector);
        when(execution.context()).thenReturn(context);
        when(execution.step()).thenReturn(Step.BEFORE);
        when(execution.method()).thenReturn(getClass().getDeclaredMethod("test_execution"));

        assertThrow(IllegalStateException.class).containingMessage("No Execution context bound to local thread !").whenRunning(new Code() {
View Full Code Here

    }

    @Test
    public void test_context() throws Exception {
        Introspector introspector = new Introspector(this);
        TestContext context = mock(TestContext.class);
        when(context.introspector()).thenReturn(introspector);

        assertThrow(MycilaTestingException.class).containingMessage("No Global Test Context available for test com.mycila.testing.core.MycilaTest#").whenRunning(new Code() {
            public void run() throws Throwable {
                Mycila.context(MycilaTest.this);
            }
View Full Code Here

    }

    @Test
    public void test_execution() throws Exception {
        Introspector introspector = new Introspector(this);
        TestContext context = mock(TestContext.class);
        final Execution execution = mock(Execution.class);
        when(context.introspector()).thenReturn(introspector);
        when(execution.context()).thenReturn(context);
        when(execution.step()).thenReturn(Step.BEFORE);
        when(execution.method()).thenReturn(getClass().getDeclaredMethod("test_execution"));

        assertThrow(IllegalStateException.class).containingMessage("No Execution context bound to local thread !").whenRunning(new Code() {
View Full Code Here

        }
    }

    public static TestContext context(Object testInstance) {
        notNull("Test instance", testInstance);
        TestContext context = CONTEXTS.get(testInstance);
        if (context == null) {
            throw new IllegalStateException("No Global Test Context available for test " + MessageFormat.format("{0}#{1,number,#}", testInstance.getClass().getName(), testInstance.hashCode()));
        }
        return context;
    }
View Full Code Here

TOP

Related Classes of com.mycila.testing.core.api.TestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.