0

Maven を使用して実行すると機能しない Junit テスト ケースがあります。しかし、Eclipse を使用して実行すると、同じテスト ケースが機能します。私の Junit クラスはこんな感じです。

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(locations = {"classpath:/test-config.xml"} )
public class TestDaoImpl { 
private final static Logger logger = Logger.getLogger(TestDaoImpl.class);

@Autowired
private MyDaoImpl myDao;

@Test
public void testMyDao() throws Exception {
logger.info("Called testMyDao()================");
     // here myDao is null and throwing NullPointerException in sunfire log.
     // But this works when I run using Eclipse.
List<MyObj> objList = myDao.getList();

}

@Test
public void testMyCode() throws Exception {
logger.info("Called testMyCode()================");
     // this test case works with Maven
List<MyObj> objList = MyClass.getList();

}



}
4

1 に答える 1

0

sunfire プラグインがありませんでした。追加すると動作し始めました。

于 2013-04-12T17:16:37.267 に答える