If I write a test class such as:
public class TryOut {
public int doStuff()
{
System.out.println("Hello");
int five = 5;
return five * 2;
}
public static void main(String[] args)
{
TryOut myTryOut = new TryOut();
myTryOut.doStuff();
}
}
and use JUnit to test it
import static org.junit.Assert.*;
import org.junit.Test;
public class TryOutTest {
@Test
public void test() {
TryOut myTryOut = new TryOut();
int answer = myTryOut.doStuff();
assertEquals(10, answer);
}
}
What I want is to step through the code when JUnit is running. Is this possible? If I set a breakpoint on the method that gets called - doStuff() and then right click on the TryOutTest class, then Debug As, JUnit test menu options, (to run the code) the breakpoint never stops the code, and the test completes.