### Question:
DuccAlgorithm { public void run(List<PositionListIndex> pliList) throws AlgorithmExecutionException { this.found = 0; this.graphTraverser.init(pliList, this.uccReceiver, this.relationName, this.columnNames); this.found = this.graphTraverser.traverseGraph(); } DuccAlgorithm(String relationName, List<String> columnNames,
                       UniqueColumnCombinationResultReceiver uccReceiver);  DuccAlgorithm(String relationName, List<String> columnNames,
                       UniqueColumnCombinationResultReceiver uccReceiver, Random random); void setRawKeyError(long keyError); void run(List<PositionListIndex> pliList); ImmutableList<ColumnCombinationBitset> getMinimalUniqueColumnCombinations(); Map<ColumnCombinationBitset, PositionListIndex> getCalculatedPlis(); public int found; }### Answer:
@Test public void testExecute() throws AlgorithmExecutionException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { AlgorithmTestFixture fixture = new AlgorithmTestFixture(); RelationalInput relationalInput = fixture.getInputGenerator().generateNewCopy(); Random random = mock(Random.class); when(random.nextInt(anyInt())).thenAnswer(new Answer<Integer>() { @Override public Integer answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); return (Integer) args[0] - 1; } }); DuccAlgorithm ducc = new DuccAlgorithm( relationalInput.relationName(), relationalInput.columnNames(), fixture.getUniqueColumnCombinationResultReceiver(), random); ducc.run(new PLIBuilder(relationalInput).getPLIList()); fixture.verifyUniqueColumnCombinationResultReceiver(); }
@Test public void testExecuteWithHoles() throws AlgorithmExecutionException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { DuccTestFixtureWithHoles fixture = new DuccTestFixtureWithHoles(); Random random = mock(Random.class); when(random.nextInt(anyInt())).thenAnswer(new Answer<Integer>() { protected int[] randomVariables = {8, 0, 0, 0, 3, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 2, 0}; protected int numberOfInvocations = 0; @Override public Integer answer(InvocationOnMock invocation) throws Throwable { if (numberOfInvocations < randomVariables.length) { return randomVariables[numberOfInvocations++]; } else { return 0; } } }); DuccAlgorithm ducc = new DuccAlgorithm(fixture.relationName, fixture.columnNames, fixture.uniqueColumnCombinationResultReceiver, random); RelationalInput relationalInput = fixture.getInputGenerator().generateNewCopy(); ducc.run(new PLIBuilder(relationalInput).getPLIList()); fixture.verifyUniqueColumnCombinationResultReceiver(); }