0

I am getting a

java.lang.UnsatisfiedLinkError:

NumberFormatCustom.toFixed(DI)Ljava/lang/String;

NumberFormatCustom.toFixed(Native Method)

@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));
}

The method toFix shown in the error is called in the format method, do I have to mock the result of toFix as well ? How can I do that ?

maxday
  • 1,322
  • 1
  • 16
  • 32
  • 1
    I don't think Mockito works well with static methods... See this http://stackoverflow.com/questions/4482315/why-does-mockito-not-mock-static-methods for example – jny Jan 28 '14 at 15:09

1 Answers1

0

As jny states, Mockito cannot mock static methods. Try PowerMock or JMockit

John B
  • 32,493
  • 6
  • 77
  • 98