@Test
public void smaWithWindowEqualLengthIsJustAverage() {

    int length = (int) (Math.random() * 1000 + 1); // uniform random in [1..1000]
    double[] data = createRandomArray(length);
    double sum = 0.0;
    for (int i = 0; i < data.length; ++i) {
        sum += data[i];
    }
    double mean = sum / data.length;
    double[] average = TimeSeriesUtilities.simpleMovingAverage(data, data.length);
    assertEquals("average has length of 1", 1, average.length);
    assertEquals("average[0] value is just the average", mean, average[0], 1.0e-10);
}