package Ġcom . github . kon f ko . core . derived Ċ Ċ import Ġcom . github . kon f ko . core . structured . Structured Settings Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ Ċ /** Ċ Ġ* Ġ@ author Ġmark opi Ċ Ġ*/ Ċ class ĠPrefix ed Settings Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġprefix Empty Key () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprefixed Ġ= Ġsettings . prefix By ("") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . get < String >(" first . url ")). isEqualTo (" jdbc : test : localhost / first ") ĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . to Flat Map ()). isEqualTo ( data ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġprefix Single Level () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprefixed Ġ= Ġsettings . prefix By (" dataSource ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . get < String >(" dataSource . first . url ")). isEqualTo (" jdbc : test : localhost / first ") ĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . to Flat Map ()). isEqualTo ( map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" dataSource . first . url " Ġto Ġ" jdbc : test : localhost / first ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" dataSource . second . url " Ġto Ġ" jdbc : test : localhost / second ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" dataSource . second . connection Timeout " Ġto Ġ" 2 0 " ĊĠĠĠĠĠĠĠ Ġ)) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( settings . find < String >(" bad DataSource . first . url ")). isNull () ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . find < String >(" dataSource . missing . url ")). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġprefix More Levels () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprefixed Ġ= Ġsettings . prefix By (" system . external . dataSource ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . get < String >(" system . external . dataSource . first . url ")). isEqualTo (" jdbc : test : localhost / first ") ĊĠĠĠĠĠĠĠ ĠassertThat ( prefix ed . to Flat Map ()). isEqualTo ( map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" system . external . dataSource . first . url " Ġto Ġ" jdbc : test : localhost / first ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" system . external . dataSource . second . url " Ġto Ġ" jdbc : test : localhost / second ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" system . external . dataSource . second . connection Timeout " Ġto Ġ" 2 0 " ĊĠĠĠĠĠĠĠ Ġ)) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( settings . find < String >(" bad Prefix . external . dataSource . first . url ")). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġdata Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" first . url " Ġto Ġ" jdbc : test : localhost / first ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" second . url " Ġto Ġ" jdbc : test : localhost / second ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" second . connection Timeout " Ġto Ġ" 2 0 " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġsettings Ġ= ĠStruct ured Settings ( data ) ĊĠĠĠ Ġ} Ċ Ċ }