0
我得到一個的Mockito UnsatisfiedLinkError
java.lang.UnsatisfiedLinkError中:
NumberFormatCustom.toFixed(DI)Ljava /朗/字符串;
NumberFormatCustom.toFixed(本機方法)
@Test
public void prepareDeForFormTest() {
assertEquals("", FormHelper.prepareDeForForm(null));
Double myDouble = 123.;
when(NumberFormatCustom.getIntegerInstance(true).format(myDouble)).thenReturn("123");
assertEquals(FormHelper.prepareDeForForm(myDouble), NumberFormatCustom.getIntegerInstance(true).format(myDouble));
}
方法toFix在錯誤所示被稱爲在格式方法,我必須嘲笑toFix的結果以及?我怎樣才能做到這一點 ?
我不認爲Mockito適用於靜態方法......請參閱http://stackoverflow.com/questions/4482315/why-does-mockito-not-mock-static-methods例如 – jny