BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / AugmentationSchemaBuilderImplTest.java
1 /*
2  * Copyright (c) 2014 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.yangtools.yang.parser.impl;
9
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertTrue;
12 import com.google.common.base.Optional;
13 import com.google.common.collect.Iterables;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18 import org.opendaylight.yangtools.yang.parser.builder.impl.AugmentationSchemaBuilderImpl;
19
20 /**
21  * @deprecated Pre-Beryllium implementation, scheduled for removal.
22  */
23 @Deprecated
24 public class AugmentationSchemaBuilderImplTest {
25
26     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl;
27     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl2;
28     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl3;
29     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl4;
30     private AugmentationSchema augmentSchema;
31
32     @Before
33     public void init() {
34         augmentSchemaBuilderImpl = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc", SchemaPath.ROOT, 1);
35         augmentSchemaBuilderImpl2 = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc2", SchemaPath.ROOT, 1);
36         augmentSchemaBuilderImpl3 = augmentSchemaBuilderImpl;
37         augmentSchemaBuilderImpl4 = new AugmentationSchemaBuilderImpl("test-module", 10, null, SchemaPath.ROOT, 1);
38         augmentSchema = augmentSchemaBuilderImpl.build();
39     }
40
41     @Test
42     public void testgetPath() {
43         assertTrue(Iterables.isEmpty(augmentSchemaBuilderImpl.getPath().getPathFromRoot()));
44     }
45
46     @Test
47     public void testEquals() {
48         assertFalse(augmentSchemaBuilderImpl.equals("test"));
49         assertFalse(augmentSchemaBuilderImpl.equals(null));
50         assertTrue(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl3));
51         assertFalse(augmentSchemaBuilderImpl4.equals(augmentSchemaBuilderImpl));
52         assertFalse(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl2));
53     }
54
55     @Test
56     public void testGetOriginalDefinition() {
57         augmentSchema = augmentSchemaBuilderImpl.build();
58         Optional<AugmentationSchema> origDefinition = augmentSchema.getOriginalDefinition();
59         assertFalse(origDefinition.isPresent());
60     }
61
62     @Test
63     public void testGetUnknownSchemaNodes() {
64         assertTrue(Iterables.isEmpty(augmentSchema.getUnknownSchemaNodes()));
65     }
66 }