PrayerTimes { public Prayer currentPrayer() { return currentPrayer(new Date()); } PrayerTimes(Coordinates coordinates, DateComponents date, CalculationParameters parameters); Prayer currentPrayer(); Prayer currentPrayer(Date time); Prayer nextPrayer(); Prayer nextPrayer(Date time); Date timeForPrayer(Prayer prayer); final Date fajr; final Date sunrise; final Date dhuhr; final Date asr; final Date maghrib; final Date isha; }
@Test public void testCurrentPrayer() { DateComponents components = new DateComponents(2015, 9, 1); CalculationParameters parameters = CalculationMethod.KARACHI.getParameters(); parameters.madhab = Madhab.HANAFI; parameters.highLatitudeRule = HighLatitudeRule.TWILIGHT_ANGLE; Coordinates coordinates = new Coordinates(33.720817, 73.090032); PrayerTimes p = new PrayerTimes(coordinates, components, parameters); assertThat(p.currentPrayer(TestUtils.addSeconds(p.fajr, -1))).isEqualTo(Prayer.NONE); assertThat(p.currentPrayer(p.fajr)).isEqualTo(Prayer.FAJR); assertThat(p.currentPrayer(TestUtils.addSeconds(p.fajr, 1))).isEqualTo(Prayer.FAJR); assertThat(p.currentPrayer(TestUtils.addSeconds(p.sunrise, 1))).isEqualTo(Prayer.SUNRISE); assertThat(p.currentPrayer(TestUtils.addSeconds(p.dhuhr, 1))).isEqualTo(Prayer.DHUHR); assertThat(p.currentPrayer(TestUtils.addSeconds(p.asr, 1))).isEqualTo(Prayer.ASR); assertThat(p.currentPrayer(TestUtils.addSeconds(p.maghrib, 1))).isEqualTo(Prayer.MAGHRIB); assertThat(p.currentPrayer(TestUtils.addSeconds(p.isha, 1))).isEqualTo(Prayer.ISHA); }