Remove redundant exception declarations
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / serialization / match / MplsLabelEntrySerializerTest.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.match;
10
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
15 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
19
20 public class MplsLabelEntrySerializerTest extends AbstractMatchEntrySerializerTest {
21
22     @Test
23     public void testSerialize() {
24         final long mplsLabel = 10L;
25
26         final Match mplsLabelMatch = new MatchBuilder()
27                 .setProtocolMatchFields(new ProtocolMatchFieldsBuilder()
28                         .setMplsLabel(mplsLabel)
29                         .build())
30                 .build();
31
32         assertMatch(mplsLabelMatch, false, (out) -> assertEquals(out.readUnsignedInt(), mplsLabel));
33     }
34
35     @Override
36     protected short getLength() {
37         return EncodeConstants.SIZE_OF_INT_IN_BYTES;
38     }
39
40     @Override
41     protected int getOxmFieldCode() {
42         return OxmMatchConstants.MPLS_LABEL;
43     }
44
45     @Override
46     protected int getOxmClassCode() {
47         return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
48     }
49
50 }