7d17d78509d35d0ee4de1215d7fc1c2c9493456b
[hc2vpp.git] /
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any;
18
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertNull;
21
22 import org.junit.Test;
23
24 public class Dot1qTagVlanIdBuilderTest {
25
26     @Test
27     public void testGetDefaultInstanceEnumeration() {
28         final Dot1qTag.VlanId any = Dot1qTagVlanIdBuilder.getDefaultInstance("any");
29         assertEquals(Dot1qTag.VlanId.Enumeration.Any, any.getEnumeration());
30         assertNull(any.getDot1qVlanId());
31     }
32
33     @Test
34     public void testGetDefaultInstanceVlanId() {
35         final Dot1qTag.VlanId any = Dot1qTagVlanIdBuilder.getDefaultInstance("123");
36         assertEquals(Integer.valueOf(123), any.getDot1qVlanId().getValue());
37         assertNull(any.getEnumeration());
38     }
39
40     @Test(expected = NumberFormatException.class)
41     public void testGetDefaultInstanceFailed() {
42         final Dot1qTag.VlanId any = Dot1qTagVlanIdBuilder.getDefaultInstance("anny");
43     }
44 }