@Test public void testMin() { double arr[] = {-1.5, 0, 2.5, 100, -50.2}; TemperatureSeriesAnalysis temperatureSeriesAnalysis = new TemperatureSeriesAnalysis(arr); double expected = -50.2; double actual = temperatureSeriesAnalysis.min(); assertEquals(expected, actual, 0.0001); }
@Test public void testMinArrayWithDifferentElements() { double[] temperatureSeries = {51.2036, -23, 12.23, 5.024, -44, 32.02, -44.0003, -20, 52, 1.235}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); double expResult = -44.0003; double actualResult = seriesAnalysis.min(); assertEquals(expResult, actualResult, epsilon); }
@Test public void testMinArrayWithPositiveElements() { double[] temperatureSeries = {51.2036, 23, 12.23, 5.024, 44}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); double expResult = 5.024; double actualResult = seriesAnalysis.min(); assertEquals(expResult, actualResult, epsilon); }
@Test public void testMinArrayWithSigleElement() { double[] temperatureSeries = {-51.2036}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); double expResult = -51.2036; double actualResult = seriesAnalysis.min(); assertEquals(expResult, actualResult, epsilon); }
@Test(expected = IllegalArgumentException.class) public void testMin_FailOnEmptyList() { double arr[] = {}; TemperatureSeriesAnalysis temperatureSeriesAnalysis = new TemperatureSeriesAnalysis(arr); temperatureSeriesAnalysis.min(); }
@Test(expected = IllegalArgumentException.class) public void testMinFailOnEmptyArray() { double[] temperatureSeries = {}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); seriesAnalysis.min(); }