package Ġcom . j ca ique . dia let us . presentation . common Ċ Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . cancel Ċ import Ġkotlinx . coroutines . new Single Thread Context Ċ import Ġkotlinx . coroutines . test . reset Main Ċ import Ġkotlinx . coroutines . test . set Main Ċ import Ġorg . junit . rules . External Resource Ċ Ċ class ĠCor outines TestHelper Ġ: ĠExternal Resource () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġsingle Thread Ġ= Ġnew Single Thread Context (" Testing Ġthread ") ĊĠĠĠ Ġval Ġscope Ġ= ĠCor outine Scope ( single Thread ) ĊĊĠĠĠ Ġoverride Ġfun Ġbefore () Ġ{ ĊĠĠĠĠĠĠĠ ĠDispatch ers . set Main ( single Thread ) ĊĠĠĠĠĠĠĠ Ġsuper . before () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġafter () Ġ{ ĊĠĠĠĠĠĠĠ ĠDispatch ers . reset Main () ĊĠĠĠĠĠĠĠ Ġsingle Thread . close () ĊĠĠĠĠĠĠĠ Ġscope . cancel () ĊĠĠĠĠĠĠĠ Ġsuper . after () ĊĠĠĠ Ġ} Ċ } Ċ