2 * Copyright (c) 2015 Cisco Systems, 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
9 package org.opendaylight.openflowplugin.impl.rpc;
11 import static org.junit.Assert.assertNotNull;
12 import static org.mockito.Mockito.verify;
14 import com.google.common.util.concurrent.SettableFuture;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.Matchers;
19 import org.mockito.Mock;
20 import org.mockito.runners.MockitoJUnitRunner;
21 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
22 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
24 @RunWith(MockitoJUnitRunner.class)
25 public class RequestContextImplTest {
28 RpcContext rpcContext;
30 RequestContext requestContext;
34 requestContext = new RequestContextImpl<>(rpcContext);
38 public void testCreateRequestFuture() throws Exception {
39 SettableFuture future = requestContext.getFuture();
40 assertNotNull(future);
44 public void testClose() throws Exception {
45 requestContext.close();
46 verify(rpcContext).forgetRequestContext(Matchers.any(RequestContext.class));