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

Examples of ar.com.dgarcia.javaspec.impl.model.SpecTest


        SpecGroup rootGroup = readSpec.getRootGroup();
        List<SpecTest> declaredTests = rootGroup.getDeclaredTests();

        assertThat(declaredTests).hasSize(1);

        SpecTest onlyTest = declaredTests.get(0);
        assertThat(onlyTest.getName()).isEqualTo("only test");
    }
View Full Code Here


        SpecGroup rootGroup = readSpec.getRootGroup();
        SpecGroup onlyGroup = rootGroup.getSubGroups().get(0);
        assertThat(onlyGroup.getName()).isEqualTo("A suite");

        SpecTest onlyTest = onlyGroup.getDeclaredTests().get(0);
        assertThat(onlyTest.getName()).isEqualTo("contains spec with an expectation");
    }
View Full Code Here

        SpecTree readSpec = parser.parse(TwoPendingTestSpecTest.class);

        List<SpecTest> declaredTest = readSpec.getRootGroup().getDeclaredTests();
        assertThat(declaredTest).hasSize(2);

        SpecTest firstTest = declaredTest.get(0);
        assertThat(firstTest.getName()).isEqualTo("xit pending test");
        assertThat(firstTest.isMarkedAsPending()).isTrue();
        assertThat(firstTest.getTestCode()).isNotNull();

        SpecTest secondTest = declaredTest.get(1);
        assertThat(secondTest.getName()).isEqualTo("non lambda pending test");
        assertThat(secondTest.isMarkedAsPending()).isTrue();
        assertThat(secondTest.getTestCode()).isNull();
    }
View Full Code Here

    @Test
    public void testShouldHaveABeforeCode(){
        SpecTree readSpec = parser.parse(BeforeUsedInOneTestSpecTest.class);

        SpecTest onlyTest = readSpec.getRootGroup().getDeclaredTests().get(0);
        assertThat(onlyTest.getName()).isEqualTo("test with before");

        List<Runnable> testBeforeBlocks = onlyTest.getBeforeBlocks();
        assertThat(testBeforeBlocks).hasSize(1);
    }
View Full Code Here

    @Test
    public void testShouldHaveAnAfterCode(){
        SpecTree readSpec = parser.parse(AfterUsedInOneTestSpecTest.class);

        SpecTest onlyTest = readSpec.getRootGroup().getDeclaredTests().get(0);
        assertThat(onlyTest.getName()).isEqualTo("test with after");

        List<Runnable> testAfterBlocks = onlyTest.getAfterBlocks();
        assertThat(testAfterBlocks).hasSize(1);
    }
View Full Code Here

    @Test
    public void testShouldHave2BeforeAnd2AfterCodes(){
        SpecTree readSpec = parser.parse(TwoBeforeAndAfterTestSpecTest.class);

        SpecTest onlyTest = readSpec.getRootGroup().getDeclaredTests().get(0);
        assertThat(onlyTest.getName()).isEqualTo("test with 2 before and 2 after");

        List<Runnable> testBeforeBlocks = onlyTest.getBeforeBlocks();
        assertThat(testBeforeBlocks).hasSize(2);

        List<Runnable> testAfterBlocks = onlyTest.getAfterBlocks();
        assertThat(testAfterBlocks).hasSize(2);
    }
View Full Code Here

    @Test
    public void shouldHave1RootTestWith1BeforeAfterAnd1NestedTestWith2BeforeAnd2AfterCodes(){
        SpecTree readSpec = parser.parse(BeforeAndAfterInheritedWhenNestedTest.class);

        SpecTest onlyRootTest = readSpec.getRootGroup().getDeclaredTests().get(0);
        assertThat(onlyRootTest.getName()).isEqualTo("test with 1 before/after set");

        List<Runnable> rootBeforeBlocks = onlyRootTest.getBeforeBlocks();
        assertThat(rootBeforeBlocks).hasSize(1);

        List<Runnable> rootAfterBlocks = onlyRootTest.getAfterBlocks();
        assertThat(rootAfterBlocks).hasSize(1);

        SpecGroup onlyGroup = readSpec.getRootGroup().getSubGroups().get(0);
        SpecTest nestedTest = onlyGroup.getDeclaredTests().get(0);

        List<Runnable> nestedTestBeforeBlocks = nestedTest.getBeforeBlocks();
        assertThat(nestedTestBeforeBlocks).hasSize(2);
        assertThat(nestedTestBeforeBlocks.get(0)).isEqualTo(rootBeforeBlocks.get(0));

        List<Runnable> nestedTestAfterBlocks = nestedTest.getAfterBlocks();
        assertThat(nestedTestAfterBlocks).hasSize(2);
        assertThat(nestedTestAfterBlocks.get(1)).isEqualTo(rootAfterBlocks.get(0));
    }
View Full Code Here

    @Test
    public void testInsideDisabledSpecShouldBePending(){
        SpecTree readSpec = parser.parse(OneTestInsideDisabledSpecTest.class);

        SpecGroup onlyGroup = readSpec.getRootGroup().getSubGroups().get(0);
        SpecTest disabledTest = onlyGroup.getDeclaredTests().get(0);

        assertThat(disabledTest.isMarkedAsPending()).isTrue();
    }
View Full Code Here

        SpecGroup rootGroup = readSpec.getRootGroup();
        List<SpecTest> declaredTests = rootGroup.getDeclaredTests();

        assertThat(declaredTests).hasSize(1);

        SpecTest onlyTest = declaredTests.get(0);
        assertThat(onlyTest.getName()).isEqualTo("only test");
    }
View Full Code Here

        SpecGroup rootGroup = readSpec.getRootGroup();
        SpecGroup onlyGroup = rootGroup.getSubGroups().get(0);
        assertThat(onlyGroup.getName()).isEqualTo("A suite");

        SpecTest onlyTest = onlyGroup.getDeclaredTests().get(0);
        assertThat(onlyTest.getName()).isEqualTo("contains spec with an expectation");
    }
View Full Code Here

TOP

Related Classes of ar.com.dgarcia.javaspec.impl.model.SpecTest

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.