/* ĠSpotify ĠWeb ĠAPI , ĠKotlin ĠWrapper ; ĠMIT ĠLicense , Ġ 2 0 1 7 - 2 0 2 1 ; ĠOriginal Ġauthor : ĠAdam ĠR atz man Ġ*/ Ċ package Ġcom . adam rat z man . spotify Ċ Ċ import Ġandroid . os . Build . VERSION Ċ import Ġjava . lang . reflect . Field Ċ import Ġjava . lang . reflect . Modifier Ċ import Ġjava . util . concurrent . Executors Ċ import Ġkotlin . coroutines . Coroutine Context Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . as Coroutine Dispatcher Ċ import Ġkotlinx . coroutines . run Blocking Ċ Ċ public Ġfun Ġset Final Static ( field : ĠField , ĠnewValue : ĠAny ?) Ġ{ ĊĠĠĠ Ġfield . is Accessible Ġ= Ġtrue ĊĠĠĠ Ġval Ġmodifiers Field Ġ= ĠField :: class . java . getDeclared Field (" modifiers ") ĊĠĠĠ Ġmodifiers Field . is Accessible Ġ= Ġtrue ĊĠĠĠ Ġmodifiers Field . setInt ( field , Ġfield . modifiers Ġand ĠModifier . FINAL . inv ()) ĊĠĠĠ Ġfield . set ( null , ĠnewValue ) Ċ } Ċ Ċ public Ġactual Ġfun Ġget EnvironmentVariable ( name : ĠString ): ĠString ? Ġ{ ĊĠĠĠ Ġset Final Static ( VERSION :: class . java . getField (" SDK _ INT "), Ġ 2 6 ) ĊĠĠĠ Ġreturn ĠSystem . getenv ( name ) Ġ?: ĠSystem . getProperty ( name ) Ċ } Ċ Ċ public Ġactual Ġfun ĠException . stack Trace () Ġ{ ĊĠĠĠ Ġprintln ( this . stack Trace . join ToString ("\ n ") Ġ{ Ġit . toString () Ġ}) ĊĠĠĠ Ġthis . printStackTrace () Ċ } Ċ Ċ public Ġactual Ġval Ġtest Coroutine Context : ĠCor outine Context Ġ= ĊĠĠĠĠĠĠĠ ĠExec utors . new Single Thread Executor (). as Coroutine Dispatcher () Ċ Ċ public Ġactual Ġfun Ġrun Blocking Test ( block : Ġsuspend ĠCor outine Scope . () Ġ-> ĠUnit ): ĠUnit Ġ= Ġrun Blocking ( test Coroutine Context ) Ġ{ Ġthis . block () Ġ} Ċ