当我们将Junit5与Jmockit1.30一起使用时显示NullPointerException
,但与Jmockit 1.37(最新版本)配合使用
这是我执行RunWith(JUnitPlatform.class)
的代码:
public class Junit5WithJmockitTest
{
Tested private User user;
Mocked private Department department;
Test void testjunit5WithJmockit37Test()
{
new Expectations()
{
{
department.getDepartmentId();
result = 1;
new Department();
result = department;
}
};
user.getUserId();
AssertionUtils.assertNotNull("", user);
}
}