Hi,

Can any one please help to resolve the above error. Also can any one
please clarify whether we can unit test j2me methods

I am trying to call J2ME APIs in one of the test methods of
Instrumentation TestCase.

I have modified the dx source code such that it converts j2me jars to
dalvik format during runtime.

package android.jsr.tests;

import android.test.InstrumentationTestCase;
import javax.microedition.lcdui.DateField;

public class MIDPTest extends InstrumentationTestCase {
        //@Override
        protected void setUp() {
                // TODO Auto-generated method stub
                try {
                        super.setUp();
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
        public void testMIDP() {
                DateField dt= new DateField("MIDP",DateField.DATE);
                System.out.println("Testing JSR MIDP 2.0"+dt.getLabel());
        }
}

Below is the stack trace of the error.

java.lang.ExceptionInInitializerError

at android.jsr.cts.MIDPTest.testMIDP(MIDPTest.java:23)
at java.lang.reflect.Method.invokeNative(Native Method)
at
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:
205)
at
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:
195)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:
444)
at android.app.Instrumentation
$InstrumentationThread.run(Instrumentation.java:1447)

Caused by: java.lang.ExceptionInInitializerError
at javax.microedition.lcdui.Item.<clinit>(Item.java:611)
... 14 more
Caused by: java.lang.ExceptionInInitializerError
at javax.microedition.lcdui.Displayable.<clinit>(Displayable.java:116)
... 15 more
Caused by: java.lang.UnsatisfiedLinkError: init
at javax.microedition.lcdui.Font.init(Native Method)
at javax.microedition.lcdui.Font.<init>(Font.java:198)
at javax.microedition.lcdui.Font.<clinit>(Font.java:465)
... 16 more

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to