### Question:
DetectorTemperatureProvider { public float getDetectorTemperature(Date date) { final long millisSince1970 = date.getTime(); final long millisSince1978 = millisSince1970 - TimeUtil.MILLIS_1978; final double secondsSinceCciEpoch = millisSince1978 / 1000; int index = (int) Math.round((secondsSinceCciEpoch - startTime) / step); if(index >= temperatures.length) { return FILL_VALUE; } return temperatures[index]; } DetectorTemperatureProvider();   DetectorTemperatureProvider(String resourceName); static DetectorTemperatureProvider create(); float getDetectorTemperature(Date date); static final float FILL_VALUE; }### Answer:
@Test public void testGetTemperature() throws Exception { final DetectorTemperatureProvider provider = getDetectorTemperatureProviderForTesting(); final long secondsSince1981 = 333849750; final long milliSecondsSince1981 = secondsSince1981 * 1000; final long milliSecondsSince1970 = milliSecondsSince1981 + TimeUtil.MILLIS_1981; final Date firstDate = new Date(milliSecondsSince1970); final Date secondDate = new Date(milliSecondsSince1970 + 300000); final Date thirdDate = new Date(milliSecondsSince1970 + 600000); final Date betweenThirdAndFourthDateLow = new Date(milliSecondsSince1970 + 749999); final Date betweenThirdAndFourthDateHigh = new Date(milliSecondsSince1970 + 750000); assertEquals(257.02, provider.getDetectorTemperature(firstDate), 0.001); assertEquals(256.95, provider.getDetectorTemperature(secondDate), 0.001); assertEquals(256.36, provider.getDetectorTemperature(thirdDate), 0.001); assertEquals(256.36, provider.getDetectorTemperature(betweenThirdAndFourthDateLow), 0.001); assertEquals(256.13, provider.getDetectorTemperature(betweenThirdAndFourthDateHigh), 0.001); }
@Test public void testAtsr1Temperature() throws Exception { final DetectorTemperatureProvider provider = getDetectorTemperatureProviderForProduction(); final Date date = TimeUtil.parseCcsdsUtcFormat("1995-01-01T00:00:00Z"); assertEquals(104.04, provider.getDetectorTemperature(date), 0.001); }