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;
13 import org.mockito.invocation.InvocationOnMock;
14 import org.mockito.stubbing.Answer;
16 public class MethodInvocationParamSaver<T> implements Answer<T> {
18 private List<List<Object>> invocationParams = new ArrayList<>();
21 public MethodInvocationParamSaver(T answer) {
26 public T answer(InvocationOnMock invocation) throws Throwable {
27 invocationParams.add(Arrays.asList(invocation.getArguments()));
31 public int getNumOfInvocations() {
32 return invocationParams.size();
35 public List<Object> getInvocationParams(int index) {
36 return invocationParams.get(index);