Convert immutable tests to JUnit5 31/101731/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 4 Jul 2022 21:31:48 +0000 (23:31 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 11 Jul 2022 09:11:10 +0000 (09:11 +0000)
Clean up warnings and use JUnit5.

Change-Id: I2461f63f50be32b4a88833c71ec5f30e7d265809
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
tests/immutables-jpms/src/main/java/module-info.java
tests/immutables-jpms/src/main/java/org/opendaylight/odlparent/test/immutables/jpms/JpmsInterface.java
tests/immutables-jpms/src/test/java/org/opendaylight/odlparent/test/immutables/jpms/JmpsInterfaceTest.java
tests/immutables-plain/src/main/java/org/opendaylight/odlparent/test/immutables/plain/PlainInterface.java
tests/immutables-plain/src/test/java/org/opendaylight/odlparent/test/immutables/plain/PlainInterfaceTest.java

index 36659b84ec437f27b6717b360af4bdbb54ce32f1..57699a32cdbb195013ebbee6912f73bab84ae80a 100644 (file)
@@ -9,5 +9,5 @@ module org.opendaylight.odlparent.test.immutables.jpms {
     exports org.opendaylight.odlparent.test.immutables.jpms;
 
     requires static com.github.spotbugs.annotations;
-    requires static org.immutables.value.annotations;
+    requires static transitive org.immutables.value.annotations;
 }
index 3538aef1d9d873f0a6ed626971ed88f514dc874d..85f2aababb3bf0eacf2d36d1fe919a47075a583f 100644 (file)
@@ -9,8 +9,15 @@ package org.opendaylight.odlparent.test.immutables.jpms;
 
 import org.immutables.value.Value.Immutable;
 
+/**
+ * Test interface.
+ */
 @Immutable
 public interface JpmsInterface {
-
+    /**
+     * Get foo.
+     *
+     * @return An integer
+     */
     int getFoo();
 }
index d88fbf9c1d4cffd2f71d2219bdff6ef467bfc69a..42d50b10d6f19d58792ea81d7c65a08846c94936 100644 (file)
@@ -7,14 +7,13 @@
  */
 package org.opendaylight.odlparent.test.immutables.jpms;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.isA;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class JmpsInterfaceTest {
     @Test
     public void testBuilder() {
-        assertThat(ImmutableJpmsInterface.builder().foo(1).build(), isA(JpmsInterface.class));
+        assertInstanceOf(JpmsInterface.class, ImmutableJpmsInterface.builder().foo(1).build());
     }
 }
index c7c9771282bf2ba4b76363d684ed884e173caf72..0e5bedc34157e3b862a4297363472d1f054e6a9b 100644 (file)
@@ -9,8 +9,15 @@ package org.opendaylight.odlparent.test.immutables.plain;
 
 import org.immutables.value.Value.Immutable;
 
+/**
+ * Test interface.
+ */
 @Immutable
 public interface PlainInterface {
-
+    /**
+     * Get bar.
+     *
+     * @return An integer
+     */
     int getBar();
 }
index 75312f7d832ce65e31d8f60b542c2c11051eec8b..faff19236bbe3ba9f17046f270d7c6aaf3d6fba3 100644 (file)
@@ -7,14 +7,13 @@
  */
 package org.opendaylight.odlparent.test.immutables.plain;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.isA;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class PlainInterfaceTest {
     @Test
     public void testBuilder() {
-        assertThat(ImmutablePlainInterface.builder().bar(1).build(), isA(PlainInterface.class));
+        assertInstanceOf(PlainInterface.class, ImmutablePlainInterface.builder().bar(1).build());
     }
 }