2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.aclservice.utils;
10 import java.util.ArrayList;
11 import java.util.Arrays;
12 import java.util.List;
14 import org.mockito.invocation.InvocationOnMock;
15 import org.mockito.stubbing.Answer;
17 public class MethodInvocationParamSaver<T> implements Answer<T> {
19 private List<List<Object>> invocationParams = new ArrayList<>();
22 public MethodInvocationParamSaver(T answer) {
27 public T answer(InvocationOnMock invocation) throws Throwable {
28 invocationParams.add(Arrays.asList(invocation.getArguments()));
32 public int getNumOfInvocations() {
33 return invocationParams.size();
36 public List<Object> getInvocationParams(int index) {
37 return invocationParams.get(index);