1

I'm working under quite old app which uses LWUIT for UI.

I'm trying currently to write unit tests for MIDlet class but because there are a lot of LWUIT static methods calls it's quite hard to make it properly working even with PowerMock.

Does anyone have example of what should be completely mocked, suppressed to finally have these tests run?

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114

2 Answers2

1

There is way too much to mock. You can either build your own LWUITImplementation class which will allow you to do some of these things (see the ports for the various platforms). Or you can migrate the code to Codename One which has its own unit testing framework and test recorder.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
0

I've actually extracted all LWUIT initialization and theme related code to a special class. I could mock it and at least test all other app functionality.

The code that is relied on LWUIT like forms and controls requires a lot of PowerMock tricks

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114