### Question:
SolarEventCalculator { protected Calendar getLocalTimeAsCalendar(BigDecimal localTimeParam, Calendar date) { if (localTimeParam == null) { return null; } Calendar resultTime = (Calendar) date.clone(); BigDecimal localTime = localTimeParam; if (localTime.compareTo(BigDecimal.ZERO) == -1) { localTime = localTime.add(BigDecimal.valueOf(24.0D)); resultTime.add(Calendar.HOUR_OF_DAY, -24); } String[] timeComponents = localTime.toPlainString().split("\\."); int hour = Integer.parseInt(timeComponents[0]); BigDecimal minutes = new BigDecimal("0." + timeComponents[1]); minutes = minutes.multiply(BigDecimal.valueOf(60)).setScale(0, RoundingMode.HALF_EVEN); if (minutes.intValue() == 60) { minutes = BigDecimal.ZERO; hour += 1; } if (hour == 24) { hour = 0; } resultTime.set(Calendar.HOUR_OF_DAY, hour); resultTime.set(Calendar.MINUTE, minutes.intValue()); resultTime.set(Calendar.SECOND, 0); resultTime.set(Calendar.MILLISECOND, 0); resultTime.setTimeZone(date.getTimeZone()); return resultTime; } SolarEventCalculator(SunLocation location, String timeZoneIdentifier);  SolarEventCalculator(SunLocation location, TimeZone timeZone); String computeSunriseTime(Zenith solarZenith, Calendar date); Calendar computeSunriseCalendar(Zenith solarZenith, Calendar date); String computeSunsetTime(Zenith solarZenith, Calendar date); Calendar computeSunsetCalendar(Zenith solarZenith, Calendar date);  }### Answer:
@Test public void testGetLocalTimeAsCalendar() { Calendar localTime = calc.getLocalTimeAsCalendar(BigDecimal.valueOf(15.5D), Calendar.getInstance()); assertEquals(15, localTime.get(Calendar.HOUR_OF_DAY)); assertEquals(30, localTime.get(Calendar.MINUTE)); }
@Test public void testGetLocalTimeAsCalendarForZero() { Calendar localTime = calc.getLocalTimeAsCalendar(BigDecimal.valueOf(0.0D), Calendar.getInstance()); assertEquals(0, localTime.get(Calendar.HOUR_OF_DAY)); assertEquals(0, localTime.get(Calendar.MINUTE)); }
@Test public void testGetLocalTimeAsCalendarForNegative() { Calendar localTime = calc.getLocalTimeAsCalendar(BigDecimal.valueOf(-10.0D), Calendar.getInstance()); assertEquals(14, localTime.get(Calendar.HOUR_OF_DAY)); assertEquals(0, localTime.get(Calendar.MINUTE)); }