As a mobile computing platform developed targeting for mobile information devices. Java ME has been widely applied with the approaching of the mobile internet era. However, because of lacking the features of reflection and dynamic proxy, the unit testing especially mock testing on Java ME is very difficult.This dissertation first analyzes the implementation mechanism of JUnit framework and mock frameworks concerning EasyMock and jMock, both of which are based on Java SE/EE platform. Then it shows the results of the research on the features of Java ME platform and unit testing frameworks including J2MEUnit, JMUnit, MockME and Hammock which apply to this platform.The research makes a further comparison of the two currently existing technological solutions for Java ME mock testing. The first solution is the static prebuilt mock class library used by Hammock, while the second one is the cross-platform testing used by MockME framework. On this basis, a new solution for Java ME mock testing aiming at the disadvantages of these solution is proposed-using an IDE plug-in to create mock classes on demand and quasi-dynamically during the phase of test-developing. In this way, the amount of problems appeared in Java ME mock testing is solved well.The new solution is implemented by Mock4ME framework. The class library of Mock4ME has rich and friendly APIs as well as good expansibility. The IDE plug-in named Mock4ME Supporting can generate mock classes and extract interfaces automatically.The successful application of Mock4ME framework in real projects proves the superiority of the new solution. It can also reduce the cost of unit testing effectively and improve the testability of Java ME application. |