BAEL-1586 Modified logic to use forEach loop (#3879)
* BAEL-1586 Modified logic to use forEach loop * BAEL-1586 Added Unit Test For Finding Average Given an Empty Array
This commit is contained in:
@@ -38,4 +38,13 @@ public class SumAndAverageInArrayTest {
|
||||
|
||||
Assert.assertEquals(expectedAvgOfArray, actualAvgOfArray, 0.0034);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAnEmptyIntArray_whenUsingStream_thenFindAverage() {
|
||||
int[] array = {};
|
||||
double expectedAvgOfArray = Double.NaN;
|
||||
double actualAvgOfArray = SumAndAverageInArray.findAverageUsingStream(array);
|
||||
|
||||
Assert.assertEquals(expectedAvgOfArray, actualAvgOfArray, 0.00);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user