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