Package com.mycila.testing.ea

Examples of com.mycila.testing.ea.Code


                    assertNull(testExecution.throwable());
                    assertTrue(testExecution.mustSkip());
                    assertEquals(flow.toString(), asList("prepare", "before", "beforeTest", "afterTest"), flow);
                } else if (testExecution.method().getName().equals("method4")) {
                    assertNotNull(testExecution.throwable());
                    assertThrow(AssertionError.class).withMessage("METHOD 4 ERROR").whenRunning(new Code() {
                        public void run() throws Throwable {
                            throw testExecution.throwable();
                        }
                    });
                    assertEquals(flow.toString(), asList("prepare", "before", "beforeTest", "method4", "afterTest"), flow);
View Full Code Here


                    assertNull(testExecution.throwable());
                    assertTrue(testExecution.mustSkip());
                    assertEquals(flow.toString(), asList("prepare", "setUp", "beforeTest", "afterTest"), flow);
                } else if (testExecution.method().getName().equals("test_method4")) {
                    assertNotNull(testExecution.throwable());
                    assertThrow(AssertionError.class).withMessage("METHOD 4 ERROR").whenRunning(new Code() {
                        public void run() throws Throwable {
                            throw testExecution.throwable();
                        }
                    });
                    assertEquals(flow.toString(), asList("prepare", "setUp", "beforeTest", "method4", "afterTest"), flow);
View Full Code Here

            } else //noinspection StringEquality
                if (!ExpectException.NO_MESSAGE.equals(expectException.containing())) {
                    assertException.containingMessage(expectException.containing());
                }
            try {
                assertException.whenRunning(new Code() {
                    public void run() throws Throwable {
                        if (testExecution.hasFailed()) {
                            throw testExecution.throwable();
                        }
                    }
View Full Code Here

            } else //noinspection StringEquality
                if (!ExpectException.NO_MESSAGE.equals(expectException.containing())) {
                    assertException.containingMessage(expectException.containing());
                }
            try {
                assertException.whenRunning(new Code() {
                    public void run() throws Throwable {
                        if (testExecution.hasFailed()) {
                            throw testExecution.throwable();
                        }
                    }
View Full Code Here

    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);
            }
        });

        Mycila.registerContext(context);
        assertEquals(Mycila.context(this), context);
        Mycila.unsetContext(context);

        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

        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() {
            public void run() throws Throwable {
                Mycila.currentExecution();
            }
        });

        Mycila.registerCurrentExecution(execution);
        assertEquals(Mycila.currentExecution(), execution);

        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(new Runnable() {
            public void run() {
                // Execution can be inherited between threads
                assertEquals(Mycila.currentExecution(), execution);
            }
        }).get();
        executorService.shutdown();

        Mycila.unsetCurrentExecution();

        assertThrow(IllegalStateException.class).containingMessage("No Execution context bound to local thread !").whenRunning(new Code() {
            public void run() throws Throwable {
                Mycila.currentExecution();
            }
        });
    }
View Full Code Here

    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);
            }
        });

        Mycila.registerContext(context);
        assertEquals(Mycila.context(this), context);
        Mycila.unsetContext(context);

        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

        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() {
            public void run() throws Throwable {
                Mycila.currentExecution();
            }
        });

        Mycila.registerCurrentExecution(execution);
        assertEquals(Mycila.currentExecution(), execution);

        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(new Runnable() {
            public void run() {
                // Execution can be inherited between threads
                assertEquals(Mycila.currentExecution(), execution);
            }
        }).get();
        executorService.shutdown();

        Mycila.unsetCurrentExecution();

        assertThrow(IllegalStateException.class).containingMessage("No Execution context bound to local thread !").whenRunning(new Code() {
            public void run() throws Throwable {
                Mycila.currentExecution();
            }
        });
    }
View Full Code Here

                    assertNull(testExecution.throwable());
                    assertTrue(testExecution.mustSkip());
                    assertEquals(flow, asList("prepare", "before", "beforeTest", "method1", "afterTest", "after", "before", "beforeTest", "method2", "afterTest", "after", "before", "beforeTest", "afterTest"), flow.toString());
                } else if (testExecution.method().getName().equals("method4")) {
                    assertNotNull(testExecution.throwable());
                    assertThrow(AssertionError.class).withMessage("METHOD 4 ERROR").whenRunning(new Code() {
                        public void run() throws Throwable {
                            throw testExecution.throwable();
                        }
                    });
                    assertEquals(flow, asList("prepare", "before", "beforeTest", "method1", "afterTest", "after", "before", "beforeTest", "method2", "afterTest", "after", "before", "beforeTest", "afterTest", "after", "before", "beforeTest", "method4", "afterTest"), flow.toString());
View Full Code Here

TOP

Related Classes of com.mycila.testing.ea.Code

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.