Mark potentially-static methods as static
[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 ch.vorburger.xtendbeans.XtendBeanGenerator;
14 import org.junit.Test;
15 import org.opendaylight.genius.mdsalutil.InstructionInfo;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
18
19 /**
20  * Test for {@link InstructionGotoTable}.
21  */
22 public class InstructionGotoTableTest {
23
24     private static final InstructionGotoTable INSTRUCTION_INFO = new InstructionGotoTable((short) 1);
25
26     @Test
27     public void newInstruction() {
28         verifyInstructionInfo(INSTRUCTION_INFO);
29     }
30
31     private static void verifyInstructionInfo(InstructionInfo instructionInfo) {
32         Instruction instruction = instructionInfo.buildInstruction(2);
33         assertEquals(2, instruction.key().getOrder().intValue());
34         assertTrue(instruction.getInstruction() instanceof GoToTableCase);
35         GoToTableCase goToTableCase = (GoToTableCase) instruction.getInstruction();
36         assertEquals((short) 1, goToTableCase.getGoToTable().getTableId().shortValue());
37     }
38
39     @Test
40     public void xtendBeanGenerator() {
41         XtendBeanGenerator generator = new XtendBeanGenerator();
42         assertEquals("new InstructionGotoTable(1 as short)", generator.getExpression(INSTRUCTION_INFO));
43     }
44 }