@Test(expected = InputMismatchException.class) public void testAddTempsFailOnTemperatureLessThenMinimum() { double[] temperatureSeries = {5.25}; double[] tempValue = {-3.02, 54.02, -273.025, 5}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); seriesAnalysis.addTemps(tempValue); }
@Test(expected = IllegalArgumentException.class) public void testAddTempsFailOnEmptyList() { double[] temperatureSeries = {2.03}; double[] tempValue = {}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); seriesAnalysis.addTemps(tempValue); }
@Test public void testAddTemps_increaseMoreThanX2() { double arr[] = {3.0, 10.2, -20.4, -1.0, -5.3, 1.0, -5.1}; double temps[] = {3.3, -10.4, 33.89, 4.4, -2.3, 8.9, 4.2, 10.10}; TemperatureSeriesAnalysis tsa = new TemperatureSeriesAnalysis(arr); int expected = 15; int actual = tsa.addTemps(temps); assertEquals(expected, actual); }
@Test public void testAddTemps_onEmptyTemps() { double arr[] = {3.0, 10.2, -20.4, -1.0, -5.3, 1.0, -5.1}; double temps[] = {}; TemperatureSeriesAnalysis tsa = new TemperatureSeriesAnalysis(arr); int expected = 7; int actual = tsa.addTemps(temps); assertEquals(expected, actual); }
@Test public void testAddTempsTempArrayWithQuantityOfElementsMoreThanInTemperatureArray() { double[] temperatureSeries = {5.25, -2.03, 21.01, 54.02, -32.012}; double[] tempValue = {4, 6.03, -20.1, -56.023, 32.02, 0.24156, -24.03}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); int expResult = 12; int actualResult = seriesAnalysis.addTemps(tempValue); assertEquals(expResult, actualResult); }
@Test public void testAddTempsArrayWithManyElements() { double[] temperatureSeries = {5.25, -2.03, 21.01, 54.02, -32.012}; double[] tempValue = {4, 6.03, -20.1, -56.023, 32.02}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); int expResult = 10; int actualResult = seriesAnalysis.addTemps(tempValue); assertEquals(expResult, actualResult); }
@Test public void testAddTempsArrayWithSingleElement() { double[] temperatureSeries = {5.25, -2.03, 21.01, 54.02, -32.012}; double[] tempValue = {4}; TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries); int expResult = 6; int actualResult = seriesAnalysis.addTemps(tempValue); assertEquals(expResult, actualResult); }