Package ar.com.dgarcia.javaspec.impl.model.impl

Examples of ar.com.dgarcia.javaspec.impl.model.impl.SpecExecutionBlock.run()


    @Test
    public void itShouldExecuteTestCode(){
        SpecExecutionBlock specBlock = SpecExecutionBlock.create(noBefores, mockedTestCode, noAfters, mockedParentContext, sharedContext);

        specBlock.run();

        verify(mockedTestCode).run();
    }

    @Test
View Full Code Here


        List<String> executionOrder = new ArrayList<>();
        Runnable beforeBlock = ()-> executionOrder.add("before");
        Runnable testBlock =()->executionOrder.add("test");

        SpecExecutionBlock specBlock = SpecExecutionBlock.create(Lists.newArrayList(beforeBlock), testBlock, noAfters, mockedParentContext, sharedContext);
        specBlock.run();

        assertThat(executionOrder).isEqualTo(Lists.newArrayList("before", "test"));
    }

    @Test
View Full Code Here

        List<String> executionOrder = new ArrayList<>();
        Runnable testBlock =()->executionOrder.add("test");
        Runnable afterBlock = ()-> executionOrder.add("after");

        SpecExecutionBlock specBlock = SpecExecutionBlock.create(noBefores, testBlock, Lists.newArrayList(afterBlock), mockedParentContext, sharedContext);
        specBlock.run();

        assertThat(executionOrder).isEqualTo(Lists.newArrayList("test", "after"));
    }

    @Test
View Full Code Here

        List<String> executionOrder = new ArrayList<>();
        Runnable firstBlock = ()-> executionOrder.add("first");
        Runnable secondBlock =()->executionOrder.add("second");

        SpecExecutionBlock specBlock = SpecExecutionBlock.create(Lists.newArrayList(firstBlock, secondBlock), mock(Runnable.class), noAfters, mockedParentContext, sharedContext);
        specBlock.run();

        assertThat(executionOrder).isEqualTo(Lists.newArrayList("first", "second"));
    }

    @Test
View Full Code Here

        List<String> executionOrder = new ArrayList<>();
        Runnable firstBlock = ()-> executionOrder.add("first");
        Runnable secondBlock =()->executionOrder.add("second");

        SpecExecutionBlock specBlock = SpecExecutionBlock.create(noBefores, mock(Runnable.class), Lists.newArrayList(firstBlock, secondBlock), mockedParentContext, sharedContext);
        specBlock.run();

        assertThat(executionOrder).isEqualTo(Lists.newArrayList("first", "second"));
    }

View Full Code Here

    @Test
    public void itShouldCreateItsOwnTestContext(){
        Runnable testCode = ()->  sharedContext.get().let("foo", ()-> 1);
        SpecExecutionBlock specBlock = SpecExecutionBlock.create(noBefores, testCode, noAfters, mockedParentContext, sharedContext);

        specBlock.run();

        verify(mockedParentContext, never()).let(anyString(), anyObject());
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.