package Ġcom . kas per sky . kas press o . device . screenshots . screenshot files Ċ Ċ import Ġandroid . os . Build Ċ Ċ private Ġconst Ġval ĠTEST _ CASE _ CLASS _ J UNIT _ 3 Ġ= Ġ" android . test . Instrumentation TestCase " Ċ private Ġconst Ġval ĠTEST _ CASE _ METHOD _ J UNIT _ 3 Ġ= Ġ" run Method " Ċ private Ġconst Ġval ĠTEST _ CASE _ CLASS _ J UNIT _ 4 Ġ= Ġ" org . junit . runners . model . Framework Method $ 1 " Ċ private Ġconst Ġval ĠTEST _ CASE _ METHOD _ J UNIT _ 4 Ġ= Ġ" run Reflect ive Call " Ċ private Ġconst Ġval ĠTEST _ CASE _ CLASS _ CU C UM BER _ JVM Ġ= Ġ" cucumber . runtime . model . C ucumber Feature " Ċ private Ġconst Ġval ĠTEST _ CASE _ METHOD _ CU C UM BER _ JVM Ġ= Ġ" run " Ċ Ċ internal Ġfun ĠArray < StackTrace Element >. find TestMethod (): ĠTest Method Ġ{ ĊĠĠĠ Ġreturn Ġfind TestClass Trace Element () ĊĠĠĠĠĠĠĠ Ġ. let Ġ{ ĠTest Method ( it . className , Ġit . methodName ) Ġ} Ċ } Ċ Ċ private Ġfun ĠArray < StackTrace Element >. find TestClass Trace Element (): ĠStack Trace Element Ġ{ ĊĠĠĠ Ġreturn Ġthis . with Index (). reversed () ĊĠĠĠĠĠĠĠ Ġ. find Ġ{ Ġ(_, Ġelement ) Ġ-> Ġelement . is J unit 3 () Ġ|| Ġelement . is J unit 4 () Ġ|| Ġelement . is C ucumber () Ġ} ĊĠĠĠĠĠĠĠ Ġ? . let Ġ{ Ġ( i , Ġ_) Ġ-> Ġextract Stack Element ( i ) Ġ} ĊĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠIllegalArgumentException (" Could Ġnot Ġfind Ġtest Ġclass ! ĠTrace : Ġ${ this . map Ġ{ Ġit . toString () Ġ}} ") Ċ } Ċ Ċ private Ġfun ĠStack Trace Element . is J unit 3 (): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn ĠTEST _ CASE _ CLASS _ J UNIT _ 3 Ġ== ĠclassName Ġ&& ĠTEST _ CASE _ METHOD _ J UNIT _ 3 Ġ== ĠmethodName Ċ } Ċ Ċ private Ġfun ĠStack Trace Element . is J unit 4 (): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn ĠTEST _ CASE _ CLASS _ J UNIT _ 4 Ġ== ĠclassName Ġ&& ĠTEST _ CASE _ METHOD _ J UNIT _ 4 Ġ== ĠmethodName Ċ } Ċ Ċ private Ġfun ĠStack Trace Element . is C ucumber (): ĠBoolean Ġ{ ĊĠĠĠ Ġreturn ĠTEST _ CASE _ CLASS _ CU C UM BER _ JVM Ġ== ĠclassName Ġ&& ĠTEST _ CASE _ METHOD _ CU C UM BER _ JVM Ġ== ĠmethodName Ċ } Ċ Ċ @ Suppress (" Magic Number ") Ċ private Ġfun ĠArray < StackTrace Element >. extract Stack Element ( i : ĠInt ): ĠStack Trace Element Ġ{ ĊĠĠĠ Ġ// ĠStack trace Ġlength Ġchanged Ġin ĠM ĊĠĠĠ Ġval Ġtest Class Trace Index Ġ= Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . M ) Ġi Ġ- Ġ 2 Ġelse Ġi Ġ- Ġ 3 ĊĠĠĠ Ġreturn Ġthis [ test Class Trace Index ] Ċ } Ċ