dcsimg
JUnit @Test not working
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Brittany_Parsons
Posted On:   Thursday, July 13, 2006 02:56 PM

Screenshot Operating system: windows xp JDK version: 5.0 update 6 eclipse version: 3.1.0 I want a test case to evaluate to true if an exception is thrown. Eclipse keeps saying that "Test cannot be resolved to a type." Here is an example of the code that is causing errors. //--------------------------------------- //Test ID: testPopFromEmptyStack //Purpose: Ensures that items cannot be popped from an empty stack //Precondition: stack is empty //Input: none //Expected output: true @Test( expected = NoSuchElementException.class ) public static void testPopFromEmptyStack() {    More>>
Screenshot

Operating system: windows xp

JDK version: 5.0 update 6

eclipse version: 3.1.0



I want a test case to evaluate to true if an exception is thrown. Eclipse keeps saying that "Test cannot be resolved to a type." Here is an example of the code that is causing errors.



//---------------------------------------

//Test ID: testPopFromEmptyStack

//Purpose: Ensures that items cannot be popped from an empty stack

//Precondition: stack is empty

//Input: none

//Expected output: true



@Test( expected = NoSuchElementException.class )

public static void testPopFromEmptyStack() {

Stack s = new Stack();

s.pop();

}

//-----------------------------------------


What am I doing wrong?    <<Less

Re: JUnit @Test not working

Posted By:   Anonymous  
Posted On:   Monday, July 17, 2006 07:49 AM

Do you have JUnit4 on your projects classpath?
About | Sitemap | Contact