InstructionInfo redesign: clean up
[genius.git] / mdsalutil / mdsalutil-api / src / test / java / org / opendaylight / genius / mdsalutil / instructions / InstructionGotoTableTest.java
1 /*
2  * Copyright © 2017 Red Hat, Inc. and others.
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 package org.opendaylight.genius.mdsalutil.instructions;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import org.junit.Test;
14 import org.opendaylight.genius.mdsalutil.InstructionInfo;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
17
18 /**
19  * Test for {@link InstructionGotoTable}.
20  */
21 public class InstructionGotoTableTest {
22     @Test
23     public void newInstruction() {
24         verifyInstructionInfo(new InstructionGotoTable((short) 1));
25     }
26
27     private void verifyInstructionInfo(InstructionInfo instructionInfo) {
28         Instruction instruction = instructionInfo.buildInstruction(2);
29         assertEquals(2, instruction.getKey().getOrder().intValue());
30         assertTrue(instruction.getInstruction() instanceof GoToTableCase);
31         GoToTableCase goToTableCase = (GoToTableCase) instruction.getInstruction();
32         assertEquals((short) 1, goToTableCase.getGoToTable().getTableId().shortValue());
33     }
34 }