Fix checkstyle in mdsal-binding-generator-impl
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / AugmentRelativeXPathTest.java
index f0ba3c292108a4d660ad80ee36d05c2d21efb321..660cf4cccefc4dfe94a2a10cbe2868200b61c79c 100644 (file)
@@ -11,19 +11,16 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
-import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding.model.api.MethodSignature;
 import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class AugmentRelativeXPathTest extends AbstractTypesTest {
@@ -33,12 +30,12 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
     }
 
     @Test
-    public void AugmentationWithRelativeXPathTest() throws IOException, SourceException, ReactorException {
+    public void testAugmentationWithRelativeXPath() {
 
         final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull("context is null", context);
-        final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();
         final List<Type> genTypes = bindingGen.generateTypes(context);
 
         assertNotNull("genTypes is null", genTypes);
@@ -50,15 +47,17 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
         GeneratedTransferObject gtTunnelKey = null;
 
         for (final Type type : genTypes) {
-            if (type.getName().equals("InterfaceKey") && type.getPackageName().contains("augment._abstract.topology")) {
+            if (!type.getPackageName().contains("augment._abstract.topology")) {
+                continue;
+            }
+
+            if (type.getName().equals("InterfaceKey")) {
                 gtInterfaceKey = (GeneratedTransferObject) type;
-            } else if (type.getName().equals("Interface")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Interface")) {
                 gtInterface = (GeneratedType) type;
-            } else if (type.getName().equals("Tunnel") && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Tunnel")) {
                 gtTunnel = (GeneratedType) type;
-            } else if (type.getName().equals("TunnelKey")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("TunnelKey")) {
                 gtTunnelKey = (GeneratedTransferObject) type;
             }
         }
@@ -69,7 +68,7 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
         assertNotNull("Interface methods are null", gtInterfaceMethods);
         MethodSignature getIfcKeyMethod = null;
         for (final MethodSignature method : gtInterfaceMethods) {
-            if (method.getName().equals("getKey")) {
+            if (BindingMapping.IDENTIFIABLE_KEY_NAME.equals(method.getName())) {
                 getIfcKeyMethod = method;
                 break;
             }
@@ -101,7 +100,7 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
         assertNotNull("Tunnel methods are null", tunnelMethods);
         MethodSignature getTunnelKeyMethod = null;
         for (MethodSignature method : tunnelMethods) {
-            if (method.getName().equals("getKey")) {
+            if (BindingMapping.IDENTIFIABLE_KEY_NAME.equals(method.getName())) {
                 getTunnelKeyMethod = method;
                 break;
             }