我有一个测试类,我尝试运行,但收到错误。
public class MyHelperTest {
@Tested
MyHelper MyHelperTestObject;
@Mocked
MyData myData;
@Test
public void setMyData(){
MyData myData = new MyData();
new MockUp<MyHelper>() {
@Mock
public MyData setMyData(){
myData.setName("IFTest");
myData.setValue("IFValue");
return myData;
}
};
String name = myData.getName();
assertEquals("IFTest", name);
} // end setMyData
} // end test
当我运行此测试时,我收到以下错误:
java.lang.AssertionError:expected:但是: at uk.co.MyHelperTest.setMyData(MyHelperTest.java)