Example usage for android.os Debug getThreadAllocCount

List of usage examples for android.os Debug getThreadAllocCount

Introduction

In this page you can find the example usage for android.os Debug getThreadAllocCount.

Prototype

@Deprecated
public static int getThreadAllocCount() 

Source Link

Document

Returns the thread-local count of objects allocated by the runtime between a #startAllocCounting() start and #stopAllocCounting() stop .

Usage

From source file:com.android.tests.lib.UnitTest.java

@Test
public void exceptions() {
    try {/*from   w  ww .j a va  2s.c  om*/
        ArrayMap map = new ArrayMap();
        map.isEmpty();
        fail();
    } catch (RuntimeException e) {
        assertEquals(RuntimeException.class, e.getClass());
        assertTrue(e.getMessage().contains("isEmpty"));
        assertTrue(e.getMessage().contains("not mocked"));
        assertTrue(e.getMessage().contains("androidstudio/not-mocked"));
    }

    try {
        Debug.getThreadAllocCount();
        fail();
    } catch (RuntimeException e) {
        assertEquals(RuntimeException.class, e.getClass());
        assertTrue(e.getMessage().contains("getThreadAllocCount"));
        assertTrue(e.getMessage().contains("not mocked"));
        assertTrue(e.getMessage().contains("androidstudio/not-mocked"));
    }

}

From source file:com.android.tests.lib.LibUnitTest.java

@Test
public void exceptions() {
    try {//from   w w w  . j  a v a  2s.  co  m
        ArrayMap map = new ArrayMap();
        map.isEmpty();
        fail();
    } catch (RuntimeException e) {
        assertEquals(RuntimeException.class, e.getClass());
        assertTrue(e.getMessage().contains("isEmpty"));
        assertTrue(e.getMessage().contains("not mocked"));
    }

    try {
        Debug.getThreadAllocCount();
        fail();
    } catch (RuntimeException e) {
        assertEquals(RuntimeException.class, e.getClass());
        assertTrue(e.getMessage().contains("getThreadAllocCount"));
        assertTrue(e.getMessage().contains("not mocked"));
    }

}