JUnit 4.0 を Eclipse で動かす
plugins/org.junit_3.8.1
をコピーして
plugin/org.junit_4.0.0
を作ってjunit-4.0.jarをjunit.jarにしてコピー。
あとはplugin/org.junit_4.0.0/META-INF/MANIFEST.MFのBundle-Versionを4.0に変更
Bundle-Version: 4.0
eclipseを起動して クラスパス変数の JUNIT_HOME の場所を変更。
>type Hoge.java import java.util.ArrayList; import junit.framework.JUnit4TestAdapter; import org.junit.*; import static org.junit.Assert.*; public class Hoge { @Test public void hoge() { assertEquals("123", "123"); } @Test(expected= IndexOutOfBoundsException.class) public void empty() { new ArrayList<Object>().get(0); } public static junit.framework.Test suite() { return new JUnit4TestAdapter(Hoge.class); } }
public static junit.framework.Test suite() を入れておけば
ファイル選んで右クリック→実行→JUnitで実行で実行もしくは
Alt+Shift+X, T でも実行できる。
3.1.2, 3.2M4 できちんと動きました。