package Ġcom . bes impl ify . android . stackoverflow user . models Ċ Ċ import Ġcom . bes impl ify . android . stackoverflow user . util . as Buffered Sources Ċ import Ġcom . bes impl ify . android . stackoverflow user . util . resources File Ċ import Ġcom . squareup . mos hi . Json Adapter Ċ import Ġcom . squareup . mos hi . M oshi Ċ import Ġcom . squareup . mos hi . Types Ċ import Ġcom . squareup . mos hi . kotlin . reflect . Kotlin Json Adapter Factory Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . Assert Ċ Ċ class ĠList Response Test Ġ{ ĊĊĠ Ġprivate Ġval Ġm oshi Ġ= ĠM oshi . Builder () ĊĠĠĠ Ġ. add ( Kotlin Json Adapter Factory ()) ĊĠĠĠ Ġ. build () ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparse UserList () Ġ{ ĊĠĠĠ Ġval Ġuser ListResponse Ġ= Ġuser ListAdapter (). fromJson ( resources File (" users . json "). as Buffered Sources ()) ĊĠĠĠ ĠAssert . assertNotNull ( user ListResponse ) ĊĠĠĠ ĠAssert . assertEquals ( 3 0 , Ġuser ListResponse ?. items ?. size ) ĊĠĠĠ ĠAssert . assertEquals ( ĊĠĠĠĠĠ ĠUser ( ĊĠĠĠĠĠĠĠĠ 2 2 6 5 6 , ĊĠĠĠĠĠĠĠ Ġ" Jon ĠS ke et ", ĊĠĠĠĠĠĠĠ Ġ" https :// www . gr avatar . com / avatar / 6 d 8 ebb 1 1 7 e 8 d 8 3 d 7 4 ea 9 5 fb dd 0 f 8 7 e 1 3 ? s = 1 2 8 & amp ; d = ident icon & amp ; r = PG ", ĊĠĠĠĠĠĠĠĠ 1 0 5 7 8 2 3 , ĊĠĠĠĠĠĠĠĠ 1 5 3 8 5 0 9 4 8 3 , ĊĠĠĠĠĠĠĠ Ġ" Reading , ĠUnited ĠKing dom " ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġuser ListResponse ?. items ?. get ( 0 ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparse Re putation History List () Ġ{ ĊĠĠĠ Ġval Ġre putation History ListResponse Ġ= ĊĠĠĠĠĠ Ġre putation History ListAdapter (). fromJson ( resources File (" re putation _ hist ories . json "). as Buffered Sources ()) ĊĊĠĠĠ ĠAssert . assertNotNull ( re putation History ListResponse ) ĊĠĠĠ ĠAssert . assertEquals ( 3 0 , Ġre putation History ListResponse ?. items ?. size ) ĊĠĠĠ ĠAssert . assertEquals ( ĊĠĠĠĠĠ ĠRe putation History ( ĊĠĠĠĠĠĠĠ Ġ" post _ up v oted ", ĊĠĠĠĠĠĠĠĠ 2 2 6 5 6 , ĊĠĠĠĠĠĠĠĠ 8 5 4 4 4 6 0 , ĊĠĠĠĠĠĠĠĠ 0 , ĊĠĠĠĠĠĠĠĠ 1 5 3 8 4 0 5 6 1 2 ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġre putation History ListResponse ?. items ?. get ( 0 ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġuser ListAdapter (): ĠJson Adapter < ListResponse < User >> Ġ{ ĊĠĠĠ Ġval Ġlist Response Ġ= ĠTypes . new Parameterized Type ( ListResponse :: class . java , ĠUser :: class . java ) ĊĠĠĠ Ġreturn Ġm oshi . adapter ( list Response ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġre putation History ListAdapter (): ĠJson Adapter < ListResponse < Re putation History >> Ġ{ ĊĠĠĠ Ġval Ġlist Response Ġ= ĠTypes . new Parameterized Type ( ListResponse :: class . java , ĠRe putation History :: class . java ) ĊĠĠĠ Ġreturn Ġm oshi . adapter ( list Response ) ĊĠ Ġ} Ċ } Ċ