Package ar.com.dgarcia.javaspec.junit

Source Code of ar.com.dgarcia.javaspec.junit.JunitTestTreeTest

package ar.com.dgarcia.javaspec.junit;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.Description;

import ar.com.dgarcia.javaspec.impl.junit.JunitTestCode;
import ar.com.dgarcia.javaspec.impl.junit.JunitTestTree;

/**
* This type verifies that the JunitTestTree behaves as expected
* Created by kfgodel on 13/07/14.
*/
public class JunitTestTreeTest {

  private JunitTestTree createdTree;

  @Before
  public void createTree(){
    Description rootDescription = Description.createSuiteDescription(JunitTestTreeTest.class);
    createdTree = JunitTestTree.create(rootDescription);
  }
 
    @Test
    public void itShouldHaveADescriptionNameWhenCreated(){
        Description junitDescription = createdTree.getJunitDescription();
        assertThat(junitDescription.getDisplayName()).isEqualTo(JunitTestTreeTest.class.getName());
    }

    @Test
    public void itShouldHaveNoTestWhenCreated(){
        assertThat(createdTree.getJunitTests()).isEmpty();
    }

    @Test
    public void itShouldAddAGivenTest(){
        JunitTestCode givenTest = mock(JunitTestCode.class);
        createdTree.addTest(givenTest);
        assertThat(createdTree.getJunitTests()).contains(givenTest);
    }
}
TOP

Related Classes of ar.com.dgarcia.javaspec.junit.JunitTestTreeTest

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.