I’m trying to get JUnit 4 tests to properly run in Eclipse Indigo SR1, but something is screwy. In the simplest case that I can think of (as below):
package ints;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class IntTest {
@Before
public void setUp() throws Exception {
System.out.println("setUp()");
}
@Test
public void test() {
System.out.println("assertEquals(1, 1);");
assertEquals(1, 1);
}
@Test
public void test2() {
System.out.println("assertEquals(1, 2);");
assertEquals(1, 2);
}
}
When I run this in Eclipse (Alt+Shift+X, T), the JUnit view reports “Runs: 0/0, Errors: 0, Failures: 0” while the console displays the below, but I’m not getting anything else. I can throw exceptions from the test methods & they aren’t displayed either.
setUp()
assertEquals(1, 1);
setUp()
assertEquals(1, 2);
Any ideas as to what gives?
For some reason uninstalling the 1.7 32-bit JDK solved this problem for me. It didn’t seem to be on the path or anything that I could figure out. It feels a little too much like magic, but it worked.
I had 4 JDKs installed (1.6 & 1.7, 32-bit & 64-bit). Now I have 3.