package Ġcom . el pass ion . main fr amer plugin . common Ċ Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Temporary Folder Ċ import Ġjava . io . File Ċ Ċ class ĠTool Configuration Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġtemporary Folder Ġ= ĠTemporary Folder () ĊĠĠĠ Ġval Ġtool Configuration Ġby Ġlazy Ġ{ ĠTool Configuration Impl ( temporary Folder . root . path ) Ġ} ĊĠĠĠ Ġval Ġconfiguration File Ġby Ġlazy Ġ{ ĠFile ( File ( temporary Folder . root . path , Ġ". main fr amer "), Ġ" config ") Ġ} ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġtemporary Folder . new Folder (". main fr amer ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Empty Machine Name If Local Properties DoesNot Exists () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertNull ( tool Configuration . read Remote Machine Name ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Empty Machine Name There Is No Re levant Property () Ġ{ ĊĠĠĠĠĠĠĠ Ġconfiguration File . write Text (" some Text ") ĊĠĠĠĠĠĠĠ ĠassertNull ( tool Configuration . read Remote Machine Name ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Remote Machine Name FromFile () Ġ{ ĊĠĠĠĠĠĠĠ Ġconfiguration File . write Text (" remote _ machine = not _ local ") ĊĠĠĠĠĠĠĠ ĠassertEquals (" not _ local ", Ġtool Configuration . read Remote Machine Name ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Correct Remote Machine Name FromFile () Ġ{ ĊĠĠĠĠĠĠĠ Ġconfiguration File . write Text (" remote _ machine = not _ even _ remote ") ĊĠĠĠĠĠĠĠ ĠassertEquals (" not _ even _ remote ", Ġtool Configuration . read Remote Machine Name ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Create Local Properties File While Writing To It () Ġ{ ĊĠĠĠĠĠĠĠ Ġtool Configuration . write Remote Machine Name (" not _ local ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( configuration File . exists ()) ĊĠĠĠĠĠĠĠ ĠassertTrue ( configuration File . read Lines (). any Ġ{ Ġit Ġ== Ġ" remote _ machine = not _ local " Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Write Correct Value ToLocal Properties () Ġ{ ĊĠĠĠĠĠĠĠ Ġtool Configuration . write Remote Machine Name (" not _ even _ remote ") ĊĠĠĠĠĠĠĠ ĠassertTrue ( configuration File . read Lines (). any Ġ{ Ġit Ġ== Ġ" remote _ machine = not _ even _ remote " Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Overwrite Value On Next WriteTo Local Properties () Ġ{ ĊĠĠĠĠĠĠĠ Ġtool Configuration . write Remote Machine Name (" machine _ 1 ") ĊĠĠĠĠĠĠĠ Ġtool Configuration . write Remote Machine Name (" machine _ 2 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( configuration File . read Lines (). none Ġ{ Ġit Ġ== Ġ" remote _ machine = machine _ 1 " Ġ}) ĊĠĠĠĠĠĠĠ ĠassertTrue ( configuration File . read Lines (). any Ġ{ Ġit Ġ== Ġ" remote _ machine = machine _ 2 " Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Append Remote Machine Name To Existing Properties () Ġ{ ĊĠĠĠĠĠĠĠ Ġconfiguration File . write Text (" some _ property = secret _ value ") ĊĠĠĠĠĠĠĠ Ġtool Configuration . write Remote Machine Name (" remote _ name ") ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertThat ( configuration File . read Lines ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" some _ property = secret _ value ", Ġ" remote _ machine = remote _ name ") ĊĠĠĠ Ġ} Ċ }