Clean up mdsal-binding-util test 98/90098/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 29 May 2020 16:10:55 +0000 (18:10 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 29 May 2020 16:10:55 +0000 (18:10 +0200)
There is no need to use Truth here, as we can do all we need with
plain JUnit. We actually can do more with assertThrows().

Change-Id: Ifff35e27db7690c052dfc1124c6990faa9f871db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-util/pom.xml
binding/mdsal-binding-util/src/test/java/org/opendaylight/mdsal/binding/util/DatastoreTest.java

index b95dd027669cf7d41c9414f38c9e1ddfa3329661..675a0972961b38dd7363bb92e72f50792e9959ce 100644 (file)
             <artifactId>javax.inject</artifactId>
             <optional>true</optional>
         </dependency>
-        <dependency>
-            <groupId>com.google.truth</groupId>
-            <artifactId>truth</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index 8e1976e2dce278d34113b8869c18e006d9576ed6..1cd953bc30cc4ae71511d4b79f8bca69a69e3b51 100644 (file)
@@ -7,33 +7,24 @@
  */
 package org.opendaylight.mdsal.binding.util;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
 
-import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 
 public class DatastoreTest {
-
     @Test
-    public void testDatastore() {
-        assertThat(Datastore.toType(Datastore.CONFIGURATION)).isEqualTo(LogicalDatastoreType.CONFIGURATION);
-        assertThat(Datastore.toType(Datastore.OPERATIONAL)).isEqualTo(LogicalDatastoreType.OPERATIONAL);
-        try {
-            Datastore.toType(null);
-            Assert.fail("Expected Datastore.toType(null) to throw NullPointerException");
-        } catch (NullPointerException e) {
-            // OK, this is what we're expecting
-        }
-
-        assertThat(Datastore.toClass(LogicalDatastoreType.CONFIGURATION)).isEqualTo(Datastore.CONFIGURATION);
-        assertThat(Datastore.toClass(LogicalDatastoreType.OPERATIONAL)).isEqualTo(Datastore.OPERATIONAL);
-        try {
-            Datastore.toClass(null);
-            Assert.fail("Expected Datastore.toClass(null) to throw NullPointerException");
-        } catch (NullPointerException e) {
-            // OK, this is what we're expecting
-        }
+    public void testDatastoreToType() {
+        assertEquals(LogicalDatastoreType.CONFIGURATION, Datastore.toType(Datastore.CONFIGURATION));
+        assertEquals(LogicalDatastoreType.OPERATIONAL, Datastore.toType(Datastore.OPERATIONAL));
+        assertThrows(NullPointerException.class, () -> Datastore.toType(null));
     }
 
+    @Test
+    public void testDatastoreToClass() {
+        assertEquals(Datastore.CONFIGURATION, Datastore.toClass(LogicalDatastoreType.CONFIGURATION));
+        assertEquals(Datastore.OPERATIONAL, Datastore.toClass(LogicalDatastoreType.OPERATIONAL));
+        assertThrows(NullPointerException.class, () -> Datastore.toClass(null));
+    }
 }