dcsimg
Does JUnit 4.5 supports org.junit.runners.Enclosed runner
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, December 28, 2008 11:10 AM

Hi, Enclosed runner (which runs all static inner classes), is introduced in JUnit 4.1 right.I don't have any issues while using org.junit.runners.Enclosed runner in JUnit versions 4.1,4.2,4.3,4.4 But,if i use org.junit.runners.Enclosed runner in JUnit4.5 compilation error is being raised My sample code which is using Enclosed runner with JUnit version 4.5, import org.junit.runners.*; import org.junit.runner.*; import org.junit.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; @RunWith(value=Enclosed.class) //Iam using Enclosed runner public class J41Innerclass{    More>>

Hi,

Enclosed runner (which runs all static inner classes), is introduced in JUnit 4.1 right.I don't have any issues while using org.junit.runners.Enclosed runner in JUnit versions 4.1,4.2,4.3,4.4


But,if i use org.junit.runners.Enclosed runner in JUnit4.5 compilation error is being raised



My sample code which is using Enclosed runner with JUnit version 4.5,





import org.junit.runners.*;

import org.junit.runner.*;

import org.junit.*;

import static org.hamcrest.CoreMatchers.*;

import static org.junit.Assert.*;


@RunWith(value=Enclosed.class) //Iam using Enclosed runner

public class J41Innerclass{


@Before

public void setup()

{

System.out.println("setup for outer class test methods");

}

@After

public void teardown()

{

System.out.println("Tear down for outer class test methods");

}

public static class publicstaticInnerclass //Inner class

{

@Test

public void tstasserttht() //Test method in inner class

{

int i=3;

System.out.println("Inside test assertThat method");

assertThat(i,is(4));

}

}

@Test

public void outermethod()

{

assertEquals(1,1);

}

}



While compiling J41Innerclass.java,the following compilation error is raised,

J41Innerclass.java:9:cannot find symbol

symbol:class Enclosed

@Runwith(value=Enclosed.class)


My Classpath env variable is set to "junit4.5.jar" file


Does JUnit 4.5 supports Enclosed runner?Pls,reply me as soon as possible.

   <<Less
About | Sitemap | Contact