package Ġar cs . core . host Ċ Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . JUnit 4 Ċ Ċ @ RunWith ( JUnit 4 :: class ) Ċ @ Opt In ( Experimental Cor outines Api :: class ) Ċ class ĠArc State Test Ġ{ ĊĠ Ġ@ Test ĊĠ Ġfun Ġarc State _ equals _ and _ hash _ only _ consider _ state () Ġ{ ĊĠĠĠ Ġval Ġerror State 1 Ġ= ĠArc State . error With ( Exception (" test 1 ")) ĊĠĠĠ Ġval Ġerror State 2 Ġ= ĠArc State . error With ( Exception (" test 2 ")) ĊĊĠĠĠ ĠassertThat ( error State 1 ). isEqualTo ( error State 2 ) ĊĠĠĠ ĠassertThat ( error State 1 . hashCode ()). isEqualTo ( error State 2 . hashCode ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġarc State _ serialize () Ġ{ ĊĠĠĠ ĠassertThat ( Arc State . Deleted . toString ()). isEqualTo (" Deleted ") ĊĠĠĠ ĠassertThat ( Arc State . Error . toString ()). isEqualTo (" Error ") ĊĠĠĠ ĠassertThat ( Arc State . In determinate . toString ()). isEqualTo (" In determinate ") ĊĠĠĠ ĠassertThat ( Arc State . Never Started . toString ()). isEqualTo (" Never Started ") ĊĠĠĠ ĠassertThat ( Arc State . Running . toString ()). isEqualTo (" Running ") ĊĠĠĠ ĠassertThat ( Arc State . Stopped . toString ()). isEqualTo (" Stopped ") ĊĠĠĠ ĠassertThat ( Arc State . error With ( Exception (" test ")). toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" Error | java . lang . Exception : Ġtest ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġarc State _ deserialize () Ġ{ ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Deleted ")). isEqualTo ( Arc State . Deleted ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Error ")). isEqualTo ( Arc State . Error ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" In determinate ")). isEqualTo ( Arc State . In determinate ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Never Started ")). isEqualTo ( Arc State . Never Started ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Running ")). isEqualTo ( Arc State . Running ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Stopped ")). isEqualTo ( Arc State . Stopped ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Error | java . lang . Exception : Ġtest ")). isEqualTo ( Arc State . Error ) ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Error | java . lang . Exception : Ġtest "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( Arc State . fromString (" Error | java . lang . Exception : Ġtest | foo "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest | foo ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparticle State _ serialize () Ġ{ ĊĠĠĠ ĠassertThat ( Particle State . Instanti ated . toString ()). isEqualTo (" Instanti ated ") ĊĠĠĠ ĠassertThat ( Particle State . First Start . toString ()). isEqualTo (" First Start ") ĊĠĠĠ ĠassertThat ( Particle State . Waiting . toString ()). isEqualTo (" Waiting ") ĊĠĠĠ ĠassertThat ( Particle State . Running . toString ()). isEqualTo (" Running ") ĊĠĠĠ ĠassertThat ( Particle State . Des ync ed . toString ()). isEqualTo (" Des ync ed ") ĊĠĠĠ ĠassertThat ( Particle State . Stopped . toString ()). isEqualTo (" Stopped ") ĊĠĠĠ ĠassertThat ( Particle State . Failed . toString ()). isEqualTo (" Failed ") ĊĠĠĠ ĠassertThat ( Particle State . Failed _ Never Started . toString ()). isEqualTo (" Failed _ Never Started ") ĊĠĠĠ ĠassertThat ( Particle State . Max Failed . toString ()). isEqualTo (" Max Failed ") ĊĠĠĠ ĠassertThat ( Particle State . failed With ( Exception (" test ")). toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" Failed | java . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( Particle State . failed Never Started With ( Exception (" test ")). toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" Failed _ Never Started | java . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( Particle State . max Failed With ( Exception (" test ")). toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" Max Failed | java . lang . Exception : Ġtest ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparticle State _ deserialize () Ġ{ ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Instanti ated ")). isEqualTo ( Particle State . Instanti ated ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" First Start ")). isEqualTo ( Particle State . First Start ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Waiting ")). isEqualTo ( Particle State . Waiting ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Running ")). isEqualTo ( Particle State . Running ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Des ync ed ")). isEqualTo ( Particle State . Des ync ed ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Stopped ")). isEqualTo ( Particle State . Stopped ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed ")). isEqualTo ( Particle State . Failed ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed _ Never Started ")) ĊĠĠĠĠĠ Ġ. isEqualTo ( Particle State . Failed _ Never Started ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Max Failed ")). isEqualTo ( Particle State . Max Failed ) ĊĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed | java . lang . Exception : Ġtest ")) ĊĠĠĠĠĠ Ġ. isEqualTo ( Particle State . Failed ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed | java . lang . Exception : Ġtest "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed | java . lang . Exception : Ġtest | foo "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest | foo ") ĊĊĠĠĠ ĠassertThat ( Particle State . fromString (" Failed _ Never Started | java . lang . Exception : Ġtest ")) ĊĠĠĠĠĠ Ġ. isEqualTo ( Particle State . Failed _ Never Started ) ĊĠĠĠ ĠassertThat ( ĊĠĠĠĠĠ ĠParticle State . fromString (" Failed _ Never Started | java . lang . Exception : Ġtest "). cause . toString () ĊĠĠĠ Ġ). isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( ĊĠĠĠĠĠ ĠParticle State . fromString (" Failed _ Never Started | java . lang . Exception : Ġtest | foo "). cause . toString () ĊĠĠĠ Ġ). isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest | foo ") ĊĊĠĠĠ ĠassertThat ( Particle State . fromString (" Max Failed | java . lang . Exception : Ġtest ")) ĊĠĠĠĠĠ Ġ. isEqualTo ( Particle State . Max Failed ) ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Max Failed | java . lang . Exception : Ġtest "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest ") ĊĠĠĠ ĠassertThat ( Particle State . fromString (" Max Failed | java . lang . Exception : Ġtest | foo "). cause . toString ()) ĊĠĠĠĠĠ Ġ. isEqualTo (" arcs . core . host . Deserial ized Exception : Ġjava . lang . Exception : Ġtest | foo ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparticle State _ has Been Started () Ġ{ ĊĠĠĠ ĠassertThat ( Particle State . First Start . has Been Started ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Waiting . has Been Started ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Running . has Been Started ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Des ync ed . has Been Started ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Stopped . has Been Started ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Failed . has Been Started ). isTrue () ĊĊĠĠĠ ĠassertThat ( Particle State . Instanti ated . has Been Started ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Failed _ Never Started . has Been Started ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Max Failed . has Been Started ). isFalse () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġparticle State _ failed () Ġ{ ĊĠĠĠ ĠassertThat ( Particle State . Failed . failed ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Failed _ Never Started . failed ). isTrue () ĊĠĠĠ ĠassertThat ( Particle State . Max Failed . failed ). isTrue () ĊĊĠĠĠ ĠassertThat ( Particle State . Instanti ated . failed ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . First Start . failed ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Waiting . failed ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Running . failed ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Des ync ed . failed ). isFalse () ĊĠĠĠ ĠassertThat ( Particle State . Stopped . failed ). isFalse () ĊĠ Ġ} Ċ } Ċ