我有以下测试代码:
package soundSystem;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class )
@ContextConfiguration(classes = CDPlayerConfig.class)
public class SonyCDPlayerTest {
@Autowired
private ICompactDisk cd;
@Test
public void cdShouldNotBeNull() {
assertNotNull(cd);
}
}
Run Code Online (Sandbox Code Playgroud)
这是一个 maven 项目,问题是完全相同的代码会在 eclipse 中运行,但不会在 intellij 中运行。
我只是找不到解决@RunWith 的方法