### Question:
IpogAlgorithm { public List<int[]> generate() { final Int2IntMap parameters = convertToFactors(configuration.getTestModel()); final int[] initialParameters = configuration.getOrder() .getInitialParameters(parameters, configuration.getTestModel().getStrength()); final List<int[]> testSuite = buildInitialTestSuite(parameters, initialParameters); final int[] remainingParameters = configuration.getOrder() .getRemainingParameters(parameters, configuration.getTestModel().getStrength()); if(configuration.getTestModel().getStrength() > 0) { extendInitialTestSuite(parameters, initialParameters, testSuite, remainingParameters); } fillEmptyValues(testSuite, parameters); return testSuite; } IpogAlgorithm(IpogConfiguration configuration); List<int[]> generate();  }### Answer:
@Test void minimalTest() { final TestModel model = new TestModel(1, new int[]{2, 3, 4}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration() .testModel(model) .build() ).generate(); verifyAllCombinationsPresent(testSuite, model.getParameterSizes(), model.getStrength()); }
@Test void oneParameterTwoValueModel() { final TestModel model = new TestModel(1, new int[]{2}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration().testModel(model).build()).generate(); assertEquals(2, testSuite.size()); assertEquals(1, testSuite.get(0).length); assertEquals(1, testSuite.get(1).length); assertEquals(0, testSuite.get(0)[0]); assertEquals(1, testSuite.get(1)[0]); }
@Test void itShouldCoverEachValueOnceForStrengthOneWithMultipleParameters() { final TestModel model = new TestModel(1, new int[]{4, 4, 4, 4}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration().testModel(model).build()).generate(); final List<int[]> expectedTestInputs = Arrays.asList( new int[]{0, 0, 0, 0}, new int[]{1, 1, 1, 1}, new int[]{2, 2, 2, 2}, new int[]{3, 3, 3, 3}); Assertions.assertEquals(IntArrayWrapper.wrapToSet(expectedTestInputs), IntArrayWrapper.wrapToSet(testSuite)); }
@Test void itShouldGenerateCartesianProductIfStrengthIsNumberOfParameters() { final TestModel model = new TestModel(7, new int[]{5, 5, 5, 5, 5, 5, 5}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration().testModel(model).build()).generate(); final Int2IntMap parameterMap = new Int2IntOpenHashMap(new int[]{0, 1, 2, 3, 4, 5, 6}, new int[]{5, 5, 5, 5, 5, 5, 5}); assertEquals(IntArrayWrapper.wrapToSet(Combinator.computeCartesianProduct(parameterMap, 7)), IntArrayWrapper.wrapToSet(testSuite)); }
@Test void itShouldGenerateAllNeededTestInputsIfSmallerStrength() { final TestModel model = new TestModel(2, new int[]{3, 3, 3, 3}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration() .testModel(model) .build() ).generate(); verifyAllCombinationsPresent(testSuite, model.getParameterSizes(), 2); }
@Test void itShouldCoverAllCombinationsIfParametersHaveDifferentSizes() { final TestModel model = new TestModel(2, new int[]{2, 5, 3, 2, 4}, Collections.emptyList(), Collections.emptyList()); final List<int[]> testSuite = new IpogAlgorithm(IpogConfiguration.ipogConfiguration().testModel(model).build()).generate(); verifyAllCombinationsPresent(testSuite, model.getParameterSizes(), 2); }