package Ġcom . re mb ert ime . location . strategy Ċ Ċ import Ġjunit . framework . TestCase . assertEquals Ċ import Ġcom . re mb ert ime . location . strategy . Retry Type . LINE AL Ċ import Ġcom . re mb ert ime . location . strategy . Retry Type . EXP ON ENTIAL _ BACK _ OFF Ċ import Ġorg . junit . Test Ċ import Ġkotlin . math . pow Ċ Ċ class ĠRetry Strategy Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġline al Strategy Ġ= ĠLINE AL ĊĠĠĠ Ġprivate Ġval Ġbackoff Strategy Ġ= ĠEXP ON ENTIAL _ BACK _ OFF ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven Line al Strategy With One Attempt Then DoNot Apply Changes On Delay () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinitial Retry Delay In Millis Ġ= Ġ 1 0 0 L ĊĠĠĠĠĠĠĠ Ġval Ġattempts Ġ= Ġ 1 ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( initial Retry Delay In Millis , Ġline al Strategy . get Delay ( initial Retry Delay In Millis , Ġattempts )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven Line al Strategy With Many Attempts Then DoNot Apply Changes On Delay () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinitial Retry Delay In Millis Ġ= Ġ 1 0 0 L ĊĠĠĠĠĠĠĠ Ġval Ġattempts Ġ= Ġ 1 0 ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( initial Retry Delay In Millis , Ġline al Strategy . get Delay ( initial Retry Delay In Millis , Ġattempts )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven Exponent ial Backoff Strategy With One Attempt Then DoNot Apply Changes On Delay () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinitial Retry Delay In Millis Ġ= Ġ 1 0 0 L ĊĠĠĠĠĠĠĠ Ġval Ġattempts Ġ= Ġ 1 ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( initial Retry Delay In Millis , Ġbackoff Strategy . get Delay ( initial Retry Delay In Millis , Ġattempts )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven Exponent ial Backoff Strategy With Many Attempts Then Increase Delay Per Attempt As Initial Delay Product Two Raised To Attempt () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinitial Retry Delay In Millis Ġ= Ġ 1 0 0 L ĊĠĠĠĠĠĠĠ Ġval Ġattempts Ġ= Ġ 1 0 ĊĊĠĠĠĠĠĠĠ Ġval Ġdelay Result Ġ= Ġ( initial Retry Delay In Millis Ġ* Ġ 2 . toDouble (). pow ( attempts Ġ- Ġ 1 )). to Long () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( delay Result , Ġbackoff Strategy . get Delay ( initial Retry Delay In Millis , Ġattempts )) ĊĠĠĠ Ġ} Ċ }