package Ġcom . fa endir . om . parser . solution Ċ Ċ import Ġcom . fa endir . om . parser . solution . model . Non S olved Solution Ċ import Ġcom . fa endir . om . parser . solution . model . S olved Solution Ċ import Ġok io . buffer Ċ import Ġok io . sink Ċ import Ġok io . source Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . hamcrest . Matchers . equalTo Ċ import Ġorg . hamcrest . Matchers . instance Of Ċ import Ġorg . junit . Test Ċ import Ġjava . io . ByteArray OutputStream Ċ Ċ internal Ġclass ĠSolution Parser Test Ġ{ ĊĊĠĠĠ Ġprivate Ġfun ĠgetS olved Stream () Ġ= Ġjava Class . class Loader . getResource AsStream (" test - pu zzle - c 7 9 0 3 4 5 8 1 9 9 9 3 5 3 6 - 1 . solution ") !!. source (). buffer () ĊĠĠĠ Ġprivate Ġfun Ġget Non S olved Stream () Ġ Ġ= Ġjava Class . class Loader . getResource AsStream (" test - pu zzle - c 7 9 0 3 4 5 8 1 9 9 9 3 5 3 6 - 2 . solution ") !!. source (). buffer () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġparse () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsolution 1 Ġ= ĠSolution Parser . parse ( getS olved Stream ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( solution 1 , Ġinstance Of ( S olved Solution :: class . java )) ĊĊĠĠĠĠĠĠĠ Ġval Ġsolution 2 Ġ= ĠSolution Parser . parse ( get Non S olved Stream ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( solution 2 , Ġinstance Of ( Non S olved Solution :: class . java )) ĊĠĠĠĠĠĠĠ Ġ// TODO : ĠAssert Ġsolution Ġcontent ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwrite () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcompare Ġ= Ġget Non S olved Stream (). read ByteArray () ĊĊĠĠĠĠĠĠĠ Ġval Ġsolution 1 Ġ= ĠSolution Parser . parse ( getS olved Stream ()) ĊĠĠĠĠĠĠĠ Ġsolution 1 . name Ġ= Ġ" NON SOL VED ĠSOL UTION " ĊĠĠĠĠĠĠĠ Ġval Ġout 1 Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠĠĠ ĠSolution Parser . write ( solution 1 , Ġout 1 . sink (). buffer ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( out 1 . toByteArray (), ĠequalTo ( compare )) ĊĊĠĠĠĠĠĠĠ Ġval Ġsolution 2 Ġ= ĠSolution Parser . parse ( get Non S olved Stream ()) ĊĠĠĠĠĠĠĠ Ġval Ġout 2 Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠĠĠ ĠSolution Parser . write ( solution 2 , Ġout 2 . sink (). buffer ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( out 2 . toByteArray (), ĠequalTo ( compare )) ĊĠĠĠ Ġ} Ċ }