package Ġorg . b sc . con fluence Ċ Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġjava . io . File Ċ import Ġjava . io . FileWriter Ċ import Ġjava . nio . file . Files Ċ import Ġjava . nio . file . Paths Ċ Ċ class ĠDeploy StateManager Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġbase dir Ġ= ĠPaths . get ( System . getProperty (" java . io . tmpdir ") Ġ); ĊĠĠĠ Ġprivate Ġval Ġstate File Ġ= ĠPaths . get ( basedir . toString (), ĠDeploy StateManager . STORAGE _ NAME ) ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġdelete Storage ( Ġ) Ġ{ ĠFiles . delete IfExists ( state File ) Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Load Null Params () Ġ= ĠassertThrows ( NullPointerException :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠ ĠDeploy StateManager . load (" endpoint ", Ġnull ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Is Updated For New File () Ġ{ ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( state File . to File (). exists ()) ĊĠĠĠĠĠĠĠ ĠassertFalse ( state File . to File (). isFile ) ĊĠĠĠĠĠĠĠ Ġval Ġd sm Ġ= ĠDeploy StateManager . load (" http :// localhost : 8 0 9 0 / con fluence ", Ġbase dir ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( state File . to File (). exists ()) ĊĠĠĠĠĠĠĠ ĠassertTrue ( state File . to File (). isFile ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest IsNot Updated For Existing File () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġd sm Ġ= ĠDeploy StateManager . load (" http :// localhost : 8 0 9 0 / con fluence ", Ġbase dir ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠĠĠĠĠ Ġval Ġd sm 2 Ġ= ĠDeploy StateManager . load (" http :// localhost : 8 0 9 0 / con fluence ", Ġbase dir ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( d sm 2 . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Is Updated For Changing Content () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtmp File Ġ= ĠFile . create TempFile (" test - con fluence - plugin -", Ġ". tmp ") ĊĊĠĠĠĠĠĠĠ ĠFile Writer ( tmp File ). use Ġ{ Ġ Ġit . write (" My Ġinitial Ġcontent ") Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġd sm Ġ= ĠDeploy StateManager . load (" http :// localhost : 8 0 9 0 / con fluence ", Ġbase dir ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( tmp File . to Path ())) ĊĠĠĠĠĠĠĠ ĠassertFalse ( d sm . is Updated ( tmp File . to Path ())) ĊĊĠĠĠĠĠĠĠ ĠFile Writer ( tmp File ). use Ġ{ Ġit . write (" My Ġchanged Ġcontent ") Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( tmp File . to Path ())) ĊĊĠĠĠĠĠĠĠ Ġ// clean - up ĊĠĠĠĠĠĠĠ Ġtmp File . delete () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġreset State () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġd sm Ġ= ĠDeploy StateManager . load (" http :// localhost : 8 0 9 0 / con fluence ", Ġbase dir ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠĠĠĠĠ ĠassertFalse ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠĠĠĠĠ Ġd sm . reset State ( Paths . get (" pom . xml ")) ĊĠĠĠĠĠĠĠ ĠassertTrue ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠĠĠĠĠ ĠassertFalse ( d sm . is Updated ( Paths . get (" pom . xml "))) ĊĠĠĠ Ġ} Ċ }