FileDocCategorySizeDatePackage
EventLogTest.javaAPI DocAndroid 1.5 API2326Wed May 06 22:42:02 BST 2009android.util

EventLogTest

public class EventLogTest extends TestCase
tests for {@link EventLog}

Fields Summary
private static final int
TEST_TAG
Constructors Summary
Methods Summary
voidassertIntInByteArrayEquals(int expected, byte[] buf, int pos)

        ByteBuffer computedBuf = ByteBuffer.wrap(buf).order(ByteOrder.nativeOrder());
        int computed = computedBuf.getInt(pos);
        Assert.assertEquals(expected, computed);
    
voidassertLongInByteArrayEquals(long expected, byte[] buf, int pos)

        ByteBuffer computedBuf = ByteBuffer.wrap(buf).order(ByteOrder.nativeOrder());
        long computed = computedBuf.getLong(pos);
        Assert.assertEquals(expected, computed);
    
voidassertStringInByteArrayEquals(java.lang.String expected, byte[] buf, int pos)

        byte[] expectedBytes = expected.getBytes();
        Assert.assertTrue(expectedBytes.length <= buf.length - pos);
        for (byte expectedByte : expectedBytes) {
            Assert.assertEquals(expectedByte, buf[pos++]);
        }
    
public voidtestIllegalListTypesThrowException()


         
        try {
            EventLog.writeEvent(TEST_TAG, new EventLog.List(new Object()));
            fail("Can't create List with any old Object");
        } catch (IllegalArgumentException e) {
            // expected
        }
        try {
            EventLog.writeEvent(TEST_TAG, new EventLog.List((byte) 1));
            fail("Can't create List with any old byte");
        } catch (IllegalArgumentException e) {
            // expected
        }