Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / registry / flow / FlowDescriptorDtoTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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 package org.opendaylight.openflowplugin.impl.registry.flow;
9
10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
15 import org.opendaylight.yangtools.yang.common.Uint8;
16
17 /**
18  * Test for {@link FlowDescriptorFactory.FlowDescriptorDto}.
19  */
20 public class FlowDescriptorDtoTest {
21
22     @Test
23     public void testCreate() {
24         final FlowDescriptor flowDescriptor = FlowDescriptorFactory.create(Uint8.ONE, new FlowId("unit:1"));
25         Assert.assertNotNull(flowDescriptor);
26         Assert.assertNotNull(flowDescriptor.getFlowId());
27         Assert.assertNotNull(flowDescriptor.getTableKey());
28     }
29
30     @Test(expected = Exception.class)
31     @SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "that is the point of this test")
32     public void testCreateNegative1() {
33         FlowDescriptorFactory.create(Uint8.ONE, null);
34     }
35 }