Ditch Google Truth 73/100873/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 17:37:31 +0000 (19:37 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 17:37:31 +0000 (19:37 +0200)
Google Truth is bringing absolutely nothing to the table here, use
baseline JUnit assertions instead.

Change-Id: I777368d1ebeee16a71a73d79839636c9e3fb8e26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/blueprint/pom.xml
opendaylight/blueprint/src/test/java/org/opendaylight/controller/blueprint/tests/DataStoreAppConfigDefaultXMLReaderTest.java

index 42a1d5a..702f5a7 100644 (file)
       <artifactId>org.osgi.util.tracker</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>com.google.truth</groupId>
-      <artifactId>truth</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
       <artifactId>mdsal-binding-test-model</artifactId>
index 6407efa..79f454d 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.blueprint.tests;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
 
 import org.junit.Test;
 import org.opendaylight.controller.blueprint.ext.DataStoreAppConfigDefaultXMLReader;
@@ -21,26 +22,26 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
  * @author Michael Vorburger.ch
  */
 public class DataStoreAppConfigDefaultXMLReaderTest extends AbstractConcurrentDataBrokerTest {
-
     @Test
     public void testConfigXML() throws Exception {
-        Lists lists = new DataStoreAppConfigDefaultXMLReader<>(
-                getClass(), "/opendaylight-sal-test-store-config.xml",
-                getDataBrokerTestCustomizer().getSchemaService(),
-                getDataBrokerTestCustomizer().getAdapterContext().currentSerializer(),
-                Lists.class).createDefaultInstance();
+        Lists lists = new DataStoreAppConfigDefaultXMLReader<>(getClass(), "/opendaylight-sal-test-store-config.xml",
+            getDataBrokerTestCustomizer().getSchemaService(),
+            getDataBrokerTestCustomizer().getAdapterContext().currentSerializer(), Lists.class)
+            .createDefaultInstance();
 
         UnorderedList element = lists.getUnorderedContainer().getUnorderedList().values().iterator().next();
-        assertThat(element.getName()).isEqualTo("someName");
-        assertThat(element.getValue()).isEqualTo("someValue");
+        assertEquals("someName", element.getName());
+        assertEquals("someValue", element.getValue());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testBadXMLName() throws Exception {
-        new DataStoreAppConfigDefaultXMLReader<>(
-                getClass(), "/badname.xml",
-                getDataBrokerTestCustomizer().getSchemaService(),
-                getDataBrokerTestCustomizer().getAdapterContext().currentSerializer(),
-                Lists.class).createDefaultInstance();
+        final var reader = new DataStoreAppConfigDefaultXMLReader<>(getClass(), "/badname.xml",
+            getDataBrokerTestCustomizer().getSchemaService(),
+            getDataBrokerTestCustomizer().getAdapterContext().currentSerializer(), Lists.class);
+
+        final String message = assertThrows(IllegalArgumentException.class, reader::createDefaultInstance).getMessage();
+        assertEquals("resource /badname.xml relative to " + DataStoreAppConfigDefaultXMLReaderTest.class.getName()
+            + " not found.", message);
     }
 }