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

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


        assertThat(disabledTest.isMarkedAsPending()).isTrue();
    }

    @Test
    public void variableDefinedInGroupShouldHaveDefinition(){
        SpecTree readSpec = parser.parse(VariableInSuitSpec.class);

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

        TestContextDefinition contextDefinition = onlyGroup.getTestContext();
        assertThat(contextDefinition.getDefinitionFor("foo")).isNotNull();
    }
View Full Code Here


        assertThat(contextDefinition.getDefinitionFor("foo")).isNotNull();
    }

    @Test
    public void rootGroupShouldHaveVariableDefinitionAndChildGroupShouldUseParents(){
        SpecTree readSpec = parser.parse(VariableDefinedInParentContextSpec.class);

        SpecGroup rootGroup = readSpec.getRootGroup();
        Supplier<Object> rootDefinition = rootGroup.getTestContext().getDefinitionFor("foo");
        assertThat(rootDefinition).isNotNull();

        SpecGroup onlyGroup = rootGroup.getSubGroups().get(0);
        Supplier<Object> childDefinition = onlyGroup.getTestContext().getDefinitionFor("foo");
View Full Code Here

        SpecParser parser = new SpecParser();
        return parser;
    }

    public SpecTree parse(Class<? extends JavaSpec> specClass) {
        SpecTree createdTree = SpecTreeDefinition.create();
        JavaSpec createdSpec = instantiate(specClass);
        createdSpec.populate(createdTree);
        return createdTree;
    }
View Full Code Here

public class JunitTestTreeAdapterTest {

    @Test
    public void itNamesTheRootGroupAfterTheTestClass(){
        Class<? extends JavaSpec> specClass = EmptySpec.class;
        SpecTree specTree = SpecParser.create().parse(specClass);

        JunitTestTreeAdapter adapter = JunitTestTreeAdapter.create(specTree, specClass);
        assertThat(adapter.getJunitTree().getJunitDescription().getDisplayName()).isEqualTo(specClass.getName());
    }
View Full Code Here

    }

    @Test
    public void itCreatesAnInnerGroupPerDescribe(){
        Class<? extends JavaSpec> specClass = OneEmptyDescribeSpec.class;
        SpecTree specTree = SpecParser.create().parse(specClass);

        JunitTestTreeAdapter adapter = JunitTestTreeAdapter.create(specTree, specClass);
        Description onlySubGroup = adapter.getJunitTree().getJunitDescription().getChildren().get(0);
        assertThat(onlySubGroup.getDisplayName()).isEqualTo("empty describe");
View Full Code Here

    }

    @Test
    public void itCreatesATestPerSpecTest(){
        Class<? extends JavaSpec> specClass = OneRootTestSpec.class;
        SpecTree specTree = SpecParser.create().parse(specClass);

        JunitTestTreeAdapter adapter = JunitTestTreeAdapter.create(specTree, specClass);
        List<JunitTestCode> junitTests = adapter.getJunitTree().getJunitTests();
        assertThat(junitTests).hasSize(1);
        assertThat(junitTests.get(0).getTestDescription().getDisplayName()).isEqualTo("only test");
View Full Code Here

TOP

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

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.