mardi 28 février 2017

Is it possible to test static functions by easyMock

I want to check if it returns with same value by using EasyMock's andReturn method. Unfortunately, I come across with "java.lang.IllegalStateException: missing behavior definition for the preceding method call:" when I use EasyMock. I guess it is not possible to test by EasyMock when I try expect method. You will understand question better in the code.

Regards Alper

Menu menu = EasyMock.createMock(Menu.class)
menu.setName("name");
        EasyMock.expect(XmlParseUtility.createLinesToParse(menu).toString()).andReturn(angularLines.toString());

Error Message :

 java.lang.IllegalStateException: missing behavior definition for the preceding     method call:
   Menu.getName()
   Usage is: expect(a.foo()).andXXX()

Aucun commentaire:

Enregistrer un commentaire