2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.impl;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertTrue;
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;
21 public class AugmentationSchemaBuilderImplTest {
23 private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl;
24 private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl2;
25 private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl3;
26 private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl4;
27 private AugmentationSchema augmentSchema;
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();
39 public void testgetPath() {
40 assertTrue(Iterables.isEmpty(augmentSchemaBuilderImpl.getPath().getPathFromRoot()));
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));
53 public void testGetOriginalDefinition() {
54 augmentSchema = augmentSchemaBuilderImpl.build();
55 Optional<AugmentationSchema> origDefinition = augmentSchema.getOriginalDefinition();
56 assertFalse(origDefinition.isPresent());
60 public void testGetUnknownSchemaNodes() {
61 assertTrue(Iterables.isEmpty(augmentSchema.getUnknownSchemaNodes()));