Remove redundant exception declarations
[openflowplugin.git] / extension / openflowplugin-extension-nicira / src / test / java / org / opendaylight / openflowplugin / extension / vendor / nicira / convertor / action / DecNshTtlConvertorTest.java
1 /*
2  * Copyright (c) 2018 SUSE LINUX GmbH.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
10
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.junit.runner.RunWith;
15 import org.mockito.Mock;
16 import org.mockito.Mockito;
17 import org.mockito.runners.MockitoJUnitRunner;
18 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionDecNshTtl;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.dec.nsh.ttl.grouping.NxActionDecNshTtl;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionDecNshTtlNodesNodeTableFlowWriteActionsCase;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.dec.nsh.ttl.grouping.NxDecNshTtl;
24
25 @RunWith(MockitoJUnitRunner.class)
26 public class DecNshTtlConvertorTest {
27
28     @Mock
29     private NxActionDecNshTtlNodesNodeTableFlowWriteActionsCase actionsCase;
30
31     @Mock
32     private Action action;
33
34     private DecNshTtlConvertor decNshTtlConvertor;
35
36     @Before
37     public void setUp() {
38         NxDecNshTtl nxDecNshTtl = Mockito.mock(NxDecNshTtl.class);
39
40         NxActionDecNshTtl nxActionDecNshTtl = Mockito.mock(NxActionDecNshTtl.class);
41         ActionDecNshTtl actionDecNshTtl = Mockito.mock(ActionDecNshTtl.class);
42
43         decNshTtlConvertor = new DecNshTtlConvertor();
44     }
45
46     @Test
47     public void testConvertSalToOf() {
48         ActionDecNshTtl actionDecNshTtl = (ActionDecNshTtl) decNshTtlConvertor.convert(actionsCase).getActionChoice();
49         Assert.assertNotNull(actionDecNshTtl);
50     }
51
52     @Test
53     public void testConvertOfToSal() {
54         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
55                 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
56         Assert.assertNotNull(actionResult);
57         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
58                 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
59         Assert.assertNotNull(actionResult1);
60         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
61                 = decNshTtlConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
62         Assert.assertNotNull(actionResult2);
63         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
64                 = decNshTtlConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
65         Assert.assertNotNull(actionResult3);
66         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
67                 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
68         Assert.assertNotNull(actionResult4);
69         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
70                 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
71         Assert.assertNotNull(actionResult5);
72     }
73 }