0cf99507b6bb84994e0bf9cd07a332f36251f007
[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
13 import com.google.common.base.Optional;
14 import com.google.common.collect.Iterables;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.parser.builder.impl.AugmentationSchemaBuilderImpl;
20
21 public class AugmentationSchemaBuilderImplTest {
22
23     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl;
24     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl2;
25     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl3;
26     private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl4;
27     private AugmentationSchema augmentSchema;
28
29     @Before
30     public void init() {
31         augmentSchemaBuilderImpl = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc", SchemaPath.ROOT, 1);
32         augmentSchemaBuilderImpl2 = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc2", SchemaPath.ROOT, 1);
33         augmentSchemaBuilderImpl3 = augmentSchemaBuilderImpl;
34         augmentSchemaBuilderImpl4 = new AugmentationSchemaBuilderImpl("test-module", 10, null, SchemaPath.ROOT, 1);
35         augmentSchema = augmentSchemaBuilderImpl.build();
36     }
37
38     @Test
39     public void testgetPath() {
40         assertTrue(Iterables.isEmpty(augmentSchemaBuilderImpl.getPath().getPathFromRoot()));
41     }
42
43     @Test
44     public void testEquals() {
45         assertFalse(augmentSchemaBuilderImpl.equals("test"));
46         assertFalse(augmentSchemaBuilderImpl.equals(null));
47         assertTrue(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl3));
48         assertFalse(augmentSchemaBuilderImpl4.equals(augmentSchemaBuilderImpl));
49         assertFalse(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl2));
50     }
51
52     @Test
53     public void testGetOriginalDefinition() {
54         augmentSchema = augmentSchemaBuilderImpl.build();
55         Optional<AugmentationSchema> origDefinition = augmentSchema.getOriginalDefinition();
56         assertFalse(origDefinition.isPresent());
57     }
58
59     @Test
60     public void testGetUnknownSchemaNodes() {
61         assertTrue(Iterables.isEmpty(augmentSchema.getUnknownSchemaNodes()));
62     }
63 }