Remove redundant exception declarations
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / serialization / instructions / MeterInstructionSerializerTest.java
1 /*
2  * Copyright (c) 2016 Pantheon Technologies s.r.o. and others.  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.impl.protocol.serialization.instructions;
10
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
20
21 public class MeterInstructionSerializerTest extends AbstractInstructionSerializerTest {
22
23     @Test
24     public void testSerialize() {
25         final long meter = 2;
26
27         final Instruction instruction = new MeterCaseBuilder()
28                 .setMeter(new MeterBuilder()
29                         .setMeterId(new MeterId(meter))
30                         .build())
31                 .build();
32
33         assertInstruction(instruction, out -> assertEquals(out.readUnsignedInt(), meter));
34     }
35
36     @Override
37     protected Class<? extends Instruction> getClazz() {
38         return MeterCase.class;
39     }
40
41     @Override
42     protected int getType() {
43         return InstructionConstants.METER_TYPE;
44     }
45
46     @Override
47     protected int getLength() {
48         return InstructionConstants.STANDARD_INSTRUCTION_LENGTH;
49     }
50
51 }