Fix asserts in BindingGeneratorImplTest 56/95556/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 25 Mar 2021 10:31:47 +0000 (11:31 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 25 Mar 2021 10:31:47 +0000 (11:31 +0100)
Assertions here are the 'assertTrue()' kind, where they really can be
much more expressive. Fix that, making failures easier to diagnose.

Change-Id: I4a244d9633e314bbf92b9d8cc1632c1058a59afd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BindingGeneratorImplTest.java

index 4c157a2a22fb3e96ce402fe282c675794ded3c10..6b82c7e4ac12fcd702f1f51d1c26c6027da5bcb1 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.mdsal.binding.generator.impl;
 
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 import org.junit.Test;
@@ -20,14 +19,13 @@ import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class BindingGeneratorImplTest {
-
     @Test
     public void isisTotpologyStatementParserTest()  {
         List<Type> generateTypes = DefaultBindingGenerator.generateFor(YangParserTestUtils.parseYangResources(
             BindingGeneratorImplTest.class,
             "/isis-topology/network-topology@2013-10-21.yang", "/isis-topology/isis-topology@2013-10-21.yang",
             "/isis-topology/l3-unicast-igp-topology@2013-10-21.yang"));
-        assertFalse(generateTypes.isEmpty());
+        assertEquals(9, generateTypes.size());
     }
 
     @Test
@@ -78,50 +76,45 @@ public class BindingGeneratorImplTest {
         Type childOfParamType = null;
         for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
-                childOfParamType = ((ParameterizedType) type)
-                        .getActualTypeArguments()[0];
+                childOfParamType = ((ParameterizedType) type).getActualTypeArguments()[0];
                 break;
             }
         }
         assertNotNull(childOfParamType);
-        assertTrue(childOfParamType.getName().equals("ChoiceTestData"));
+        assertEquals("ChoiceTestData", childOfParamType.getName());
 
         implements1 = myList.getImplements();
         childOfParamType = null;
         for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
-                childOfParamType = ((ParameterizedType) type)
-                        .getActualTypeArguments()[0];
+                childOfParamType = ((ParameterizedType) type).getActualTypeArguments()[0];
                 break;
             }
         }
         assertNotNull(childOfParamType);
-        assertTrue(childOfParamType.getName().equals("ChoiceTestData"));
+        assertEquals("ChoiceTestData", childOfParamType.getName());
 
         implements1 = myContainer2.getImplements();
         childOfParamType = null;
         for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
-                childOfParamType = ((ParameterizedType) type)
-                        .getActualTypeArguments()[0];
+                childOfParamType = ((ParameterizedType) type).getActualTypeArguments()[0];
                 break;
             }
         }
         assertNotNull(childOfParamType);
-        assertTrue(childOfParamType.getName().equals("Myrootcontainer"));
+        assertEquals("Myrootcontainer", childOfParamType.getName());
 
         implements1 = myList2.getImplements();
         childOfParamType = null;
         for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
-                childOfParamType = ((ParameterizedType) type)
-                        .getActualTypeArguments()[0];
+                childOfParamType = ((ParameterizedType) type).getActualTypeArguments()[0];
                 break;
             }
         }
         assertNotNull(childOfParamType);
-        assertTrue(childOfParamType.getName().equals("Myrootcontainer"));
-
+        assertEquals("Myrootcontainer", childOfParamType.getName());
     }
 
     @Test
@@ -156,5 +149,4 @@ public class BindingGeneratorImplTest {
         assertNull(childOf);
         assertNotNull(dataObject);
     }
-
 }