diff --git a/lib/build.gradle b/lib/build.gradle index d0ddfd2..5239971 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -35,16 +35,18 @@ dependencies { implementation "io.cloudquery:plugin-pb-java:0.0.5" implementation "org.apache.arrow:arrow-vector:12.0.1" + testImplementation(platform('org.junit:junit-bom:5.10.0')) + testImplementation('org.junit.jupiter:junit-jupiter:5.10.0') + testImplementation('org.junit.jupiter:junit-jupiter-api:5.10.0') + testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.10.0') + testImplementation 'org.assertj:assertj-core:3.24.2' } -testing { - suites { - // Configure the built-in test suite - test { - // Use JUnit4 test framework - useJUnit('4.13.2') - } +test { + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" } } diff --git a/lib/src/test/java/io/cloudquery/glob/GlobTest.java b/lib/src/test/java/io/cloudquery/glob/GlobTest.java index 51e6847..6dadffb 100644 --- a/lib/src/test/java/io/cloudquery/glob/GlobTest.java +++ b/lib/src/test/java/io/cloudquery/glob/GlobTest.java @@ -1,12 +1,12 @@ package io.cloudquery.glob; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import static io.cloudquery.glob.Glob.GLOB; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class GlobTest { @Test @@ -75,7 +75,7 @@ public void testGlobs() { assertGlobMatch(pattern, "this is a ϗѾ test"); } - for(String pattern:List.of( + for (String pattern : List.of( "test*", // Implicit substring match "*is", // Partial match "*no*", // Globs without a match between them @@ -90,11 +90,11 @@ public void testGlobs() { } public void assertGlobMatch(String pattern, String subject) { - assertTrue(String.format("\"%s\" should match \"%s\"", pattern, subject), Glob.match(pattern, subject)); + assertTrue(Glob.match(pattern, subject), String.format("\"%s\" should match \"%s\"", pattern, subject)); } public void assertNotGlobMatch(String pattern, String subject) { - assertFalse(String.format("\"%s\" should not match \"%s\"", pattern, subject), Glob.match(pattern, subject)); + assertFalse(Glob.match(pattern, subject), String.format("\"%s\" should not match \"%s\"", pattern, subject)); } } \ No newline at end of file diff --git a/lib/src/test/java/io/cloudquery/scalar/BinaryTest.java b/lib/src/test/java/io/cloudquery/scalar/BinaryTest.java new file mode 100644 index 0000000..f498143 --- /dev/null +++ b/lib/src/test/java/io/cloudquery/scalar/BinaryTest.java @@ -0,0 +1,33 @@ +package io.cloudquery.scalar; + +import io.cloudquery.scalar.Binary; +import io.cloudquery.scalar.ValidationException; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + + +public class BinaryTest { + @Test + public void testNew() { + assertDoesNotThrow(() -> { + new Binary(); + }); + } + + @Test + public void testNewWithValidParam() { + assertDoesNotThrow(() -> { + new Binary("abc"); + }); + } + + @Test + public void testNewWithInvalidParam() { + assertThrows(ValidationException.class, () -> { + new Binary(false); + }); + } +} diff --git a/lib/src/test/java/io/cloudquery/schema/TableFilterDFSTest.java b/lib/src/test/java/io/cloudquery/schema/TableFilterDFSTest.java index afbe7cc..3d98173 100644 --- a/lib/src/test/java/io/cloudquery/schema/TableFilterDFSTest.java +++ b/lib/src/test/java/io/cloudquery/schema/TableFilterDFSTest.java @@ -1,14 +1,14 @@ package io.cloudquery.schema; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.List; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class TableFilterDFSTest { public static final List BASIC_TABLES = Stream.of("table1", "table2", "table3").map( diff --git a/lib/src/test/java/io/cloudquery/schema/TableFlattenTest.java b/lib/src/test/java/io/cloudquery/schema/TableFlattenTest.java index f402a52..967ea55 100644 --- a/lib/src/test/java/io/cloudquery/schema/TableFlattenTest.java +++ b/lib/src/test/java/io/cloudquery/schema/TableFlattenTest.java @@ -1,10 +1,10 @@ package io.cloudquery.schema; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class TableFlattenTest { diff --git a/lib/src/test/java/io/cloudquery/schema/TableMaxTest.java b/lib/src/test/java/io/cloudquery/schema/TableMaxTest.java index 2ba40d4..f912fc2 100644 --- a/lib/src/test/java/io/cloudquery/schema/TableMaxTest.java +++ b/lib/src/test/java/io/cloudquery/schema/TableMaxTest.java @@ -1,11 +1,11 @@ package io.cloudquery.schema; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class TableMaxTest { diff --git a/lib/src/test/java/io/cloudquery/server/AddressTest.java b/lib/src/test/java/io/cloudquery/server/AddressTest.java index 5292a6e..dfa3500 100644 --- a/lib/src/test/java/io/cloudquery/server/AddressTest.java +++ b/lib/src/test/java/io/cloudquery/server/AddressTest.java @@ -1,17 +1,17 @@ package io.cloudquery.server; import io.cloudquery.server.AddressConverter.Address; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AddressTest { private AddressConverter addressConverter; - @Before + @BeforeEach public void setUp() { addressConverter = new AddressConverter(); } @@ -31,6 +31,6 @@ public void shouldThrowExceptionIfAddressNotFormattedCorrectly() { AddressConverter addressConverter = new AddressConverter(); - Assert.assertThrows(AddressConverter.AddressParseException.class, () -> addressConverter.convert(rawAddress)); + assertThrows(AddressConverter.AddressParseException.class, () -> addressConverter.convert(rawAddress)); } } \ No newline at end of file diff --git a/lib/src/test/java/io/cloudquery/server/PluginServeTest.java b/lib/src/test/java/io/cloudquery/server/PluginServeTest.java index b4d5d00..eb8f19f 100644 --- a/lib/src/test/java/io/cloudquery/server/PluginServeTest.java +++ b/lib/src/test/java/io/cloudquery/server/PluginServeTest.java @@ -2,20 +2,20 @@ import io.cloudquery.plugin.Plugin; import io.cloudquery.server.PluginServe.PluginServeBuilder; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.util.List; -@Ignore(value = "blocking tests - only used manually to test the gRPC runs correctly") +@Disabled(value = "blocking tests - only used manually to test the gRPC runs correctly") public class PluginServeTest { public static final String URL = "https://sentry.url"; private Plugin plugin; - @Before + @BeforeEach public void setUp() { plugin = Plugin.builder("test-plugin", "0.1.0").build(); }