2 * Copyright © 2017 Red Hat, Inc. and others.
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
8 package org.opendaylight.genius.mdsalutil.instructions;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
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;
20 * Test for {@link InstructionGotoTable}.
22 public class InstructionGotoTableTest {
24 private static final InstructionGotoTable INSTRUCTION_INFO = new InstructionGotoTable((short) 1);
27 public void newInstruction() {
28 verifyInstructionInfo(INSTRUCTION_INFO);
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());
40 public void xtendBeanGenerator() {
41 XtendBeanGenerator generator = new XtendBeanGenerator();
42 assertEquals("new InstructionGotoTable(1 as short)", generator.getExpression(INSTRUCTION_INFO));