@Test public void testCalculateParameterArray() { DataDrivenParameterArray expectedArray = new DataDrivenParameterArray(); String className = "com.epam.test.TestClass"; Whitebox.setInternalState(underTest, "feeder", feeder); Whitebox.setInternalState(underTest, "nextDataFeederLoader", null); given(feeder.calculateParameterArray(className, inputParameterArray)).willReturn(expectedArray); DataDrivenParameterArray actualArray = underTest.calculateParameterArray(className, inputParameterArray); Assert.assertEquals(expectedArray, actualArray); }
public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { if (feeder == null) { AllTestRunner.CONSOLE_LOG.info("\nERROR: Data Feeder Class: " + feederClassName + " calculateParameterArray() method was failed, because the feeder class is missing" + " at Class in testlist: " + className + "\nPlease fix it!\nNow exiting..."); throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_MISSING); } DataDrivenParameterArray newArray = feeder.calculateParameterArray(className, inputParameterArray); if (newArray == null) { throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_DATA_CALCULATION_ERROR); } if (nextDataFeederLoader != null) { newArray = nextDataFeederLoader.calculateParameterArray(className, newArray); } return newArray; }
DataFeederLoader { public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { if (feeder == null) { AllTestRunner.CONSOLE_LOG.info("\nERROR: Data Feeder Class: " + feederClassName + " calculateParameterArray() method was failed, because the feeder class is missing" + " at Class in testlist: " + className + "\nPlease fix it!\nNow exiting..."); throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_MISSING); } DataDrivenParameterArray newArray = feeder.calculateParameterArray(className, inputParameterArray); if (newArray == null) { throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_DATA_CALCULATION_ERROR); } if (nextDataFeederLoader != null) { newArray = nextDataFeederLoader.calculateParameterArray(className, newArray); } return newArray; } }
DataFeederLoader { public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { if (feeder == null) { AllTestRunner.CONSOLE_LOG.info("\nERROR: Data Feeder Class: " + feederClassName + " calculateParameterArray() method was failed, because the feeder class is missing" + " at Class in testlist: " + className + "\nPlease fix it!\nNow exiting..."); throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_MISSING); } DataDrivenParameterArray newArray = feeder.calculateParameterArray(className, inputParameterArray); if (newArray == null) { throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_DATA_CALCULATION_ERROR); } if (nextDataFeederLoader != null) { newArray = nextDataFeederLoader.calculateParameterArray(className, newArray); } return newArray; } DataFeederLoader(final String className, final String feederDescriptor, final Environment environment); }
DataFeederLoader { public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { if (feeder == null) { AllTestRunner.CONSOLE_LOG.info("\nERROR: Data Feeder Class: " + feederClassName + " calculateParameterArray() method was failed, because the feeder class is missing" + " at Class in testlist: " + className + "\nPlease fix it!\nNow exiting..."); throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_MISSING); } DataDrivenParameterArray newArray = feeder.calculateParameterArray(className, inputParameterArray); if (newArray == null) { throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_DATA_CALCULATION_ERROR); } if (nextDataFeederLoader != null) { newArray = nextDataFeederLoader.calculateParameterArray(className, newArray); } return newArray; } DataFeederLoader(final String className, final String feederDescriptor, final Environment environment); int calculateRuns(final String className, final int count); DataDrivenParameters getParameterRow(final String className, final int drivenDataRowNo); DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray); void reserveParameterArray(final DataDrivenParameterArray parameterArray); static void reportError(final String message); static void reportException(final String message, final Exception e); }
DataFeederLoader { public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { if (feeder == null) { AllTestRunner.CONSOLE_LOG.info("\nERROR: Data Feeder Class: " + feederClassName + " calculateParameterArray() method was failed, because the feeder class is missing" + " at Class in testlist: " + className + "\nPlease fix it!\nNow exiting..."); throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_MISSING); } DataDrivenParameterArray newArray = feeder.calculateParameterArray(className, inputParameterArray); if (newArray == null) { throw new ShutDownException(ExitCode.EXIT_CODE_DATA_FEEDER_CLASS_DATA_CALCULATION_ERROR); } if (nextDataFeederLoader != null) { newArray = nextDataFeederLoader.calculateParameterArray(className, newArray); } return newArray; } DataFeederLoader(final String className, final String feederDescriptor, final Environment environment); int calculateRuns(final String className, final int count); DataDrivenParameters getParameterRow(final String className, final int drivenDataRowNo); DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray); void reserveParameterArray(final DataDrivenParameterArray parameterArray); static void reportError(final String message); static void reportException(final String message, final Exception e);  }