StandardParameterBuilder implements ParameterBuilder { @Override public List<Object> getParameters() { List<Object> result = new LinkedList<>(originalParameters); for (Entry<Integer, Object> entry : replacedIndexAndParameters.entrySet()) { result.set(entry.getKey(), entry.getValue()); } for (Entry<Integer, Collection<Object>> entry : ((TreeMap<Integer, Collection<Object>>) addedIndexAndParameters).descendingMap().entrySet()) { if (entry.getKey() > result.size()) { result.addAll(entry.getValue()); } else { result.addAll(entry.getKey(), entry.getValue()); } } for (int index : removeIndexAndParameters) { result.remove(index); } return result; }  void addAddedParameters(final int index, final Collection<Object> parameters); void addReplacedParameters(final int index, final Object parameter); void addRemovedParameters(final int index); @Override List<Object> getParameters();  }
@Test public void assertGetParameters() { assertThat(parameterBuilder.getParameters(), is(Arrays.<Object>asList(1, 1, 5, 7))); }