2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.vpp.test.util;
19 import static org.mockito.Matchers.any;
20 import static org.mockito.Mockito.when;
22 import java.util.Collections;
23 import javax.annotation.Nonnull;
24 import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
25 import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
26 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
29 * VPP translation test helper, that helps stubbing {@link FutureJVppCore#swInterfaceDump}.
31 public interface InterfaceDumpHelper extends FutureProducer {
34 * Stubs swInterfaceDump to return given list of interfaces.
36 * @param api vppApi reference
37 * @param interfaces list of interface details to be returned
39 default void whenSwInterfaceDumpThenReturn(@Nonnull final FutureJVppCore api,
40 final SwInterfaceDetails... interfaces) {
41 final SwInterfaceDetailsReplyDump reply = new SwInterfaceDetailsReplyDump();
42 Collections.addAll(reply.swInterfaceDetails, interfaces);
43 when(api.swInterfaceDump(any())).thenReturn(future(reply));