package Ġleak can ary Ċ Ċ import Ġandroid . os . Build . VERSION . SDK _ INT Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Ass ume . assume True Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Temporary Folder Ċ import Ġsh ark . H prof Heap Graph . Companion . open Heap Graph Ċ import Ġsh ark . hex Identity HashCode Ċ Ċ class ĠAndroid Extensions Test Ġ{ ĊĊĠ Ġ@ get : Rule ĊĠ Ġvar Ġtest Folder Ġ= ĠTemporary Folder () ĊĊĠ Ġ@ Test Ġfun Ġidentity HashCode () Ġ{ ĊĠĠĠ Ġassume True (" SDK _ INT Ġis Ġ$ SDK _ INT , Ġshadow \ $_ monitor _ Ġwas Ġintroduced Ġin Ġ 2 1 ", ĠSDK _ INT Ġ>= Ġ 2 4 ) ĊĊĠĠĠ Ġ// Ġleak can ary . Android Extensions Test @ c 5 5 9 9 5 5 ĊĠĠĠ Ġval Ġthis ToString Ġ= ĠtoString () ĊĊĠĠĠ Ġval Ġheap Dump File Ġ= Ġtest Folder . new File () ĊĠĠĠ ĠAndroid Debug Heap Dump er . dump Heap ( heap Dump File ) ĊĊĠĠĠ Ġval Ġtest ClassName Ġ= Ġthis :: class . java . name ĊĊĠĠĠ Ġval Ġidentity HashCode From Dump Ġ= Ġheap Dump File . open Heap Graph (). use Ġ{ Ġgraph Ġ-> ĊĠĠĠĠĠ Ġval Ġtest Class Ġ= Ġgraph . find Class ByName ( test ClassName ) !! ĊĠĠĠĠĠ Ġval Ġtest Instance Ġ= Ġtest Class . instances . single () ĊĠĠĠĠĠ Ġtest Instance . hex Identity HashCode ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠassertThat ("$ test ClassName @ $ identity HashCode From Dump "). isEqualTo ( this ToString ) ĊĠ Ġ} Ċ } Ċ