我有以下测试代码:
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);
}
}
这是一个Maven项目,问题是相同的代码可以在Eclipse中运行,但不能在Intellij中运行。我找不到解决@RunWith的方法。