package Ġme . h uf man . android aut oid rive Ċ Ċ import Ġme . h uf man . android aut oid rive . phone ui . Day Counter Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Assert . assertNot Equals Ċ import Ġorg . junit . Test Ċ Ċ class ĠDon ation Request Test Ġ{ Ċ ĉ class ĠDay Increment ed Ġ{ Ċĉ ĉ var Ġdays Ġ= Ġ 0 Ċĉ ĉ fun Ġon Day Increment ed () Ġ{ Ċĉĉ ĉ days Ġ+= Ġ 1 Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest First Day () Ġ{ Ċĉ ĉ val Ġapp Settings Ġ= ĠMock AppSettings ( Ċĉĉĉ ĉ AppSettings . KEYS . D ON ATION _ LAST _ DAY Ġto Ġ" 2 0 0 0 - 0 1 - 0 1 ", Ċĉĉĉ ĉ AppSettings . KEYS . D ON ATION _ DAYS _ COUNT Ġto Ġ" 0 ") Ċĉ ĉ val Ġday Increment ed Ġ= ĠDay Increment ed () Ċĉ ĉ val Ġday Counter Ġ= ĠDay Counter ( app Settings ) Ġ{ Ġday Increment ed . on Day Increment ed () Ġ} Ċĉ ĉ assertEquals ( 0 , Ġday Counter . days Count ed ()) Ċĉ ĉ day Counter . count Usage () Ċĉ ĉ assertNot Equals (" 2 0 0 0 - 0 1 - 0 1 ", Ġapp Settings [ AppSettings . KEYS . D ON ATION _ LAST _ DAY ]) Ċĉ ĉ assertEquals (" 1 ", Ġapp Settings [ AppSettings . KEYS . D ON ATION _ DAYS _ COUNT ]) ĊĊĉ ĉ assertEquals ( 1 , Ġday Increment ed . days ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Same Day () Ġ{ Ċĉ ĉ val Ġapp Settings Ġ= ĠMock AppSettings ( Ċĉĉĉ ĉ AppSettings . KEYS . D ON ATION _ LAST _ DAY Ġto Ġ" 2 0 0 0 - 0 1 - 0 1 ", Ċĉĉĉ ĉ AppSettings . KEYS . D ON ATION _ DAYS _ COUNT Ġto Ġ" 0 ") Ċĉ ĉ val Ġday Increment ed Ġ= ĠDay Increment ed () Ċĉ ĉ val Ġday Counter Ġ= ĠDay Counter ( app Settings ) Ġ{ Ġday Increment ed . on Day Increment ed () Ġ} Ċĉ ĉ assertEquals ( 0 , Ġday Counter . days Count ed ()) Ċĉ ĉ day Counter . count Usage () ĊĊĉ ĉ assertEquals (" 1 ", Ġapp Settings [ AppSettings . KEYS . D ON ATION _ DAYS _ COUNT ]) Ċĉ ĉ assertEquals ( 1 , Ġday Increment ed . days ) ĊĊĉ ĉ // Ġthe Ġsame Ġday Ġshouldn 't Ġincrement Ġthe ĠDays Ċĉ ĉ day Counter . count Usage () Ġ// Ġagain Ġon Ġthe Ġsame Ġday Ċĉ ĉ assertEquals (" 1 ", Ġapp Settings [ AppSettings . KEYS . D ON ATION _ DAYS _ COUNT ]) Ċĉ ĉ assertEquals ( 1 , Ġday Increment ed . days ) Ċ ĉ } Ċ }