package Ġcom . fs ck . k 9 Ċ Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġjava . util . Calendar Ċ import Ġorg . junit . Assert . assertFalse Ċ import Ġorg . junit . Assert . assertTrue Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Mockito . mock Ċ Ċ class ĠQu iet Time Checker Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġclock Ġ= Ġmock ( Clock :: class . java ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠendTime Before StartTime _ time Is Before EndOf Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 0 2 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 2 2 : 3 0 ", Ġ" 0 6 : 4 5 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠendTime Before StartTime _ time Is After EndOf Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 1 0 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 2 2 : 3 0 ", Ġ" 0 6 : 4 5 ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠendTime Before StartTime _ time Is After Start Of Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 2 3 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 2 2 : 3 0 ", Ġ" 0 6 : 4 5 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠendTime Before StartTime _ time Is Start Of Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 2 2 : 3 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 2 2 : 3 0 ", Ġ" 0 6 : 4 5 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠendTime Before StartTime _ time Is EndOf Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 0 6 : 4 5 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 2 2 : 3 0 ", Ġ" 0 6 : 4 5 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Before EndTime _ time Is Before Start Of Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 0 2 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 9 : 0 0 ", Ġ" 1 7 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Before EndTime _ time Is After Start Of Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 1 0 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 9 : 0 0 ", Ġ" 1 7 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Before EndTime _ time Is After EndOf Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 2 0 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 9 : 0 0 ", Ġ" 1 7 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Before EndTime _ time Is Start Of Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 0 9 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 9 : 0 0 ", Ġ" 1 7 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Before EndTime _ time Is EndOf Quiet Time () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 1 7 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 9 : 0 0 ", Ġ" 1 7 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Equals EndTime _ time Is Different From Start And EndOf Quiet Time _ should Return False () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 1 0 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 6 : 0 0 ", Ġ" 0 6 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠstartTime Equals EndTime _ time Is EqualTo Start And EndOf Quiet Time _ should Return False () Ġ{ ĊĠĠĠĠĠĠĠ Ġset Clock To (" 0 6 : 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġquiet Time Checker Ġ= ĠQu iet Time Checker ( clock , Ġ" 0 6 : 0 0 ", Ġ" 0 6 : 0 0 ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( quiet Time Checker . is Quiet Time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġset Clock To ( time : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( hour OfDay , Ġminute ) Ġ= Ġtime . split (': '). map Ġ{ Ġit . toInt () Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġcalendar Ġ= ĠCalendar . getInstance () ĊĠĠĠĠĠĠĠ Ġcalendar . set ( Calendar . HOUR _ OF _ DAY , Ġhour OfDay ) ĊĠĠĠĠĠĠĠ Ġcalendar . set ( Calendar . MINUTE , Ġminute ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtime In Millis Ġ= Ġcalendar . time In Millis ĊĠĠĠĠĠĠĠ Ġwhenever ( clock . time ). thenReturn ( time In Millis ) ĊĠĠĠ Ġ} Ċ } Ċ