Do not declare google.truth dependency 82/100882/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 20:43:29 +0000 (22:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 20:44:22 +0000 (22:44 +0200)
Remove last users of Truth with some amount of verbosity and remove the
declaration.

JIRA: ODLPARENT-283
Change-Id: Ica6b51a29ab43fc9d7e6e87f949a0ea44be79e10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bundles-test-lib/pom.xml
bundles-test-lib/src/test/java/org/opendaylight/odlparent/bundlestest/lib/ServiceReferenceUtilTest.java
features-test/pom.xml
features-test/src/test/java/org/opendaylight/odlparent/featuretest/ReflectionUtilTest.java
odlparent-dependency-check/pom.xml
odlparent-lite/pom.xml
odlparent/pom.xml

index 7a65c7ccdb297663aedf41d3cb0e02c214f60a4e..f2d477ca56d2a3142dd0e4b0cd6853794c40f556 100644 (file)
         </exclusion>
       </exclusions>
     </dependency>
-    <!-- BEWARE of adding additional dependencies here...
-         It will cause weird issues e.g. in integration/distribution/features/repos/distribution -->
-    <dependency>
-      <groupId>com.google.truth</groupId>
-      <artifactId>truth</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
-
 </project>
index ceb8be55ec1fa73b612abf2abca4611f714367fc..f719cfd58650694ab99f5974f5b1071ea35d66ba 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.odlparent.bundlestest.lib;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Dictionary;
 import java.util.HashMap;
@@ -26,15 +28,18 @@ public class ServiceReferenceUtilTest {
 
     @Test
     public void testGetUsingBundleSymbolicNames() {
-        assertThat(new ServiceReferenceUtil().getUsingBundleSymbolicNames(getServiceReference())).isEmpty();
+        assertEquals(List.of(), new ServiceReferenceUtil().getUsingBundleSymbolicNames(getServiceReference()));
     }
 
     @Test
     public void testGetProperties() {
-        assertThat(new ServiceReferenceUtil().getProperties(getServiceReference())).containsExactly(
-                "property1", "value1",
-                "property2", List.of("value2.1", "value2.2"),
-                "property3", null);
+        final var map = new ServiceReferenceUtil().getProperties(getServiceReference());
+        assertEquals(3, map.size());
+        assertEquals("value1", map.get("property1"));
+        assertEquals(List.of("value2.1", "value2.2"), map.get("property2"));
+        // Unfortunate null;
+        assertTrue(map.containsKey("property3"));
+        assertNull(map.get("property3"));
     }
 
     private static ServiceReference<?> getServiceReference() {
index 1120e4f2a5eed10175fea77b8ec2db919633813f..82755d9b04b75db9478e2e87901b626eae35b76c 100644 (file)
             <scope>provided</scope>
         </dependency>
         <dependency>
-          <groupId>com.google.guava</groupId>
-          <artifactId>guava</artifactId>
-          <scope>compile</scope>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <scope>compile</scope>
         </dependency>
         <!-- The following, which are just transitive dependencies of bundles4-test,
              have to be repeated here so that the Embed-Dependency below for maven-bundle-plugin works: -->
         <dependency>
-          <groupId>org.hamcrest</groupId>
-          <artifactId>hamcrest</artifactId>
-          <scope>provided</scope>
-        </dependency>
-        <dependency>
-          <groupId>org.awaitility</groupId>
-          <artifactId>awaitility</artifactId>
-          <scope>provided</scope>
-          <exclusions>
-            <exclusion>
-              <groupId>cglib</groupId>
-              <artifactId>cglib-nodep</artifactId>
-            </exclusion>
-            <exclusion>
-              <groupId>org.objenesis</groupId>
-              <artifactId>objenesis</artifactId>
-            </exclusion>
-          </exclusions>
-        </dependency>
-        <!-- Real <scope>test dependencies, just for SingleFeatureTestUnitTest -->
-        <dependency>
-          <groupId>com.google.truth</groupId>
-          <artifactId>truth</artifactId>
-          <scope>test</scope>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>cglib</groupId>
+                    <artifactId>cglib-nodep</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.objenesis</groupId>
+                    <artifactId>objenesis</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>
 
index 90541c61b10ce6db7bc9f96c030d00b44ae71110..4e3eda8636c13046eb962ebf72dc51340d03b7f1 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.odlparent.featuretest;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -19,26 +20,28 @@ import org.junit.Test;
  * @author Michael Vorburger.ch
  */
 public class ReflectionUtilTest {
-
     @Test
     public void testGetClasses() {
-        assertThat(ReflectionUtil.getClasses(getClass().getClassLoader(), "org.awaitility")
-                .collect(Collectors.toList()))
-                .containsAtLeast(org.awaitility.Awaitility.class, org.awaitility.core.ConditionTimeoutException.class);
+        assertTrue(ReflectionUtil.getClasses(getClass().getClassLoader(), "org.awaitility")
+            .collect(Collectors.toList())
+            .containsAll(
+                List.of(org.awaitility.Awaitility.class, org.awaitility.core.ConditionTimeoutException.class)));
     }
 
     @Test
     public void testGetInnerClasses() {
         List<Class<?>> innerClasses = ReflectionUtil.getClasses(
                 getClass().getClassLoader(), getClass().getPackage().getName()).collect(Collectors.toList());
-        assertThat(innerClasses).containsAtLeast(getClass(), InnerStaticClass.class, InnerNonStaticClass.class);
-        assertThat(innerClasses.stream().anyMatch(
-            clazz -> clazz.getName().endsWith(getClass().getSimpleName() + "$1"))).isTrue();
-        assertThat(innerClasses).containsNoDuplicates();
+        assertTrue(innerClasses.containsAll(List.of(getClass(), InnerStaticClass.class, InnerNonStaticClass.class)));
+        assertTrue(innerClasses.stream().anyMatch(
+            clazz -> clazz.getName().endsWith(getClass().getSimpleName() + "$1")));
+        assertEquals(innerClasses.stream().distinct().collect(Collectors.toList()), innerClasses);
     }
 
     @SuppressWarnings("unused")
-    private final InnerNonStaticClass anoymousInnerClass = new InnerNonStaticClass() { };
+    private final InnerNonStaticClass anonymousInnerClass = new InnerNonStaticClass() {
+
+    };
 
     private static class InnerStaticClass {
 
index 3c083c84917154b206e2c79303e5e886214dd52f..dffc7665c180cbd5393744a1ce54fff2bc5e382d 100644 (file)
             <groupId>com.google.guava</groupId>
             <artifactId>guava-testlib</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.google.truth.extensions</groupId>
-            <artifactId>truth-java8-extension</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.truth</groupId>
-            <artifactId>truth</artifactId>
-        </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
             <artifactId>javax.inject</artifactId>
index bca29a624a25eee87230de61deb84768163a4688..f385c1c8de1b5e4dbecb47970333250882405e8b 100644 (file)
               <links>
                 <link>https://junit.org/junit4/javadoc/4.13.2/</link>
                 <link>http://hamcrest.org/JavaHamcrest/javadoc/2.2/</link>
-                <link>http://google.github.io/truth/api/1.1/</link>
                 <link>http://www.slf4j.org/apidocs/</link>
                 <link>https://xerces.apache.org/xerces2-j/javadocs/api/</link>
                 <link>https://google.github.io/guava/releases/31.1-jre/api/docs/</link>
index 10c94d4f2a21c2b2ce26f446cc58b8f31b6d9576..910086ac051092c5bee648de02ee182dcf21e802 100644 (file)
         <version>2.2</version>
         <scope>test</scope>
       </dependency>
-      <dependency>
-        <groupId>com.google.truth</groupId>
-        <artifactId>truth</artifactId>
-        <!-- When bumping this version, remember to also change the JavaDoc link in odlparent-lite -->
-        <version>1.1.3</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>com.google.truth.extensions</groupId>
-        <artifactId>truth-java8-extension</artifactId>
-        <version>1.1.3</version>
-        <scope>test</scope>
-      </dependency>
       <dependency>
         <groupId>org.awaitility</groupId>
         <artifactId>awaitility</artifactId>