### Question:
FourierTransform { public Complex[] forwardFFT(double[] signal) { FastFourierTransformer transformer = new FastFourierTransformer(); double[] windowedSignal = windowFunction.applyWindow(signal); double[] paddedSignal = padWithZeroIfNecessary(windowedSignal); return transformer.transform(paddedSignal); } FourierTransform(WindowType windowType, double parameter);  FourierTransform(WindowType windowType);  FourierTransform(); Complex[] forwardFFT(double[] signal); double[] inverseFFT(Complex[] fft); static int getPowerOfTwoSize(int initialSize); static double[] padWithZeroIfNecessary(double[] signal); static double[] getFrequencies(double[] signal, double samplingFrequency); double[] calculatePowerSpectrum(double[] samples);  }### Answer:
@Test public void testForwardFFT() { FourierTransform transform = new FourierTransform(); double[] signal = new double[] {1,4,2,-1,7,4,5,2}; Complex[] expectedFFT = new Complex[] { new Complex(24.00000000,0), new Complex(-3.87867966, 5.12132034), new Complex(1.00000000,-7), new Complex(-8.12132034,-0.87867966), new Complex(6.00000000, 0), new Complex(-8.12132034, 0.87867966), new Complex(1.00000000,7), new Complex(-3.87867966, -5.12132034) }; Complex[] actualFFT = transform.forwardFFT(signal); assertArrayEquals(expectedFFT, actualFFT, new Complex(1e-5, 1e-5)); }
@Test public void testForwardFFTNotPowerOf2() { FourierTransform transform = new FourierTransform(); double[] signal = new double[] {1, 8, 3, -5, 4}; Complex[] expectedFFT = new Complex[] { new Complex(11.00000000, 0), new Complex(6.19238816, -5.12132034), new Complex(2.00000000, -13), new Complex(-12.19238816, +0.87867966), new Complex(5.00000000, 0), new Complex(-12.19238816, -0.87867966), new Complex(2.00000000, 13), new Complex(6.19238816, +5.12132034) }; Complex[] actualFFT = transform.forwardFFT(signal); assertArrayEquals(expectedFFT, actualFFT, new Complex(1e-5, 1e-5)); }