@Test(expected=IllegalArgumentException.class)
public void lengthConsistencyTest() {

    int length = (int) (Math.random() * 1000 + 1); // uniform random in [1..1000]
    double[] data = createRandomArray(length);
    int window = (int) (Math.random() * length);
    window = Math.max(window, 2);
    window = Math.min(window, length);
    double[] average = new double[data.length - window - 1]; // Sign mistake in size...
    TimeSeriesUtilities.simpleMovingAverage(data, window, average);
}