ExtendedTestCasepublic abstract class ExtendedTestCase extends com.sun.midp.i3test.TestCase Extension to the basic TestCase class to add ContentHandler
specific assert methods. |
Fields Summary |
---|
String | classnameClassname of the MIDlet. |
Methods Summary |
---|
public void | assertEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)Override assertEquals to allow null pointers.
if (expected == actual) {
// The identity and the null == null
return;
}
if (expected != null) {
assertTrue(message, expected.equals(actual));
} else {
assertTrue(message, actual.equals(expected));
}
| public void | assertEquals(java.lang.String msg, InvocationImpl expected, InvocationImpl actual)Assert that all of the fields of the two InvocationImpls match
exactly.
if (expected == actual) {
return;
}
assertNotNull(msg + " expected: ", actual);
if (actual == null) {
return;
}
assertEquals("verify getID", expected.getID(), actual.getID());
assertEquals("verify getType", expected.getType(), actual.getType());
assertEquals("verify getURL", expected.getURL(), actual.getURL());
assertTrue("verify responseRequired",
expected.getResponseRequired() == actual.getResponseRequired());
assertEquals("verify action",
expected.getAction(), actual.getAction());
assertEquals("verify classname",
expected.classname, actual.classname);
assertEquals("verify invokingSuiteId", expected.invokingSuiteId,
actual.invokingSuiteId);
assertEquals("verify invokingClassname",
expected.invokingClassname,
actual.invokingClassname);
assertEquals("verify tid", expected.tid, actual.tid);
assertEquals("verify invokingAuthority",
expected.invokingAuthority,
actual.invokingAuthority);
assertEquals("verify invokingID", expected.invokingID,
actual.invokingID);
assertEquals("verify previousTid",
expected.previousTid, actual.previousTid);
assertEquals("verify arguments",
expected.getArgs(), actual.getArgs());
String[] args = expected.getArgs();
int argsLen = args != null ? args.length : 0;
assertEquals("verify argsLen", argsLen, actual.argsLen);
assertEquals("verify data", expected.data, actual.data);
| public void | assertEquals(java.lang.String msg, java.lang.String[] s1, java.lang.String[] s2)Compare two arrays of strings, must be the same length
and contents to match.
// Identical arrays are equals
if (s1 == s2) {
return;
}
// If either array is null then they don't match
if (s1 == null) {
fail("mismatched arg arrays; expected is null");
return;
}
if (s2 == null) {
fail("mismatched arg arrays; actual is null");
return;
}
// If the lengths are unequal then they are not equal
assertEquals("mismatched arg lengths", s1.length, s2.length);
if (s1.length == s2.length) {
// Compare the strings in each array
for (int i = 0; i < s1.length; i++) {
// Two strings, non-null of the same length
assertEquals("arg " + i, s1[i], s2[i]);
}
}
| public void | assertEquals(java.lang.String msg, byte[] expected, byte[] actual)Compare two byte arrays; must be same length.
if (expected == actual) {
return;
}
if (expected == null) {
fail("expected string array is null");
return;
}
if (actual == null) {
fail("actual string array is null");
return;
}
assertEquals(msg + " length", expected.length, actual.length);
int badbytes = 0;
if (expected.length == actual.length) {
for (int i = 0; i < expected.length; i++) {
if (expected[i] != actual[i]) {
if (0 == badbytes++) {
fail(msg + " data does not match");
}
assertEquals(" " + i + ": ", expected[i], actual[i]);
}
}
}
| RegistryImpl | getRegistry()Initialize the registry for this application.
try {
SecurityToken token = getSecurityToken();
MIDletStateHandler mstate =
MIDletStateHandler.getMidletStateHandler();
MIDletSuite msuite = mstate.getMIDletSuite();
msuite.setTempProperty(token, "MIDlet-1",
"CHAPI Tests,," + classname);
return RegistryImpl.getRegistryImpl(classname, token);
} catch (SecurityException sx) {
fail("SecurityException: can't setTempProperty");
} catch (Throwable t) {
assertNull("i3test can't get registry for class " + classname, t);
t.printStackTrace();
}
return null;
| public static void | sleep(long millis)Sleep a bit.
try {
Thread.sleep(millis);
} catch (InterruptedException ie) {
}
|
|