diff --git a/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro34099/Repro34099Test.kt b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro34099/Repro34099Test.kt new file mode 100644 index 0000000000000..5e63473cbc4b9 --- /dev/null +++ b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro34099/Repro34099Test.kt @@ -0,0 +1,23 @@ +package io.quarkus.it.testing.repro34099 + +import io.quarkus.test.junit.QuarkusTest +import java.time.Duration +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertTimeout + +@QuarkusTest +class Repro34099Test { + @Test + fun javaAssertion() { + Assertions.assertTimeout(Duration.ofSeconds(1)) {} + } + + @Test + @Disabled("https://github.com/quarkusio/quarkus/issues/34099") + // fails with `Linkage loader constraint violation` + fun kotlinAssertion() { + assertTimeout(Duration.ofSeconds(1)) {} + } +} diff --git a/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro42000/Repro42000Test.kt b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro42000/Repro42000Test.kt new file mode 100644 index 0000000000000..cbcb4a259fbb1 --- /dev/null +++ b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/testing/repro42000/Repro42000Test.kt @@ -0,0 +1,42 @@ +package io.quarkus.it.testing.repro42000 + +import io.quarkus.test.junit.QuarkusTest +import java.util.stream.Stream +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.MethodSource + +@QuarkusTest +class Repro42000Test { + companion object { + val lambda: (String) -> String = { s -> s } + + fun function(s: String) = s + + @JvmStatic + fun lambdaProvider(): Stream { + return Stream.of(Arguments.of(lambda)) + } + + @JvmStatic + fun functionProvider(): Stream { + return Stream.of(Arguments.of(::function)) + } + } + + @ParameterizedTest + @MethodSource("lambdaProvider") + @Disabled("https://github.com/quarkusio/quarkus/issues/42000") + // fails with `IllegalArgumentException: argument type mismatch` + fun testLambdaProvider(function: (String) -> String) { + assertNotNull(function) + } + + @ParameterizedTest + @MethodSource("functionProvider") + fun testFunctionProvider(function: (String) -> String) { + assertNotNull(function) + } +} diff --git a/integration-tests/main/src/main/java/io/quarkus/it/testing/repro44320/MyService.java b/integration-tests/main/src/main/java/io/quarkus/it/testing/repro44320/MyService.java new file mode 100644 index 0000000000000..1f2b031c1d5fd --- /dev/null +++ b/integration-tests/main/src/main/java/io/quarkus/it/testing/repro44320/MyService.java @@ -0,0 +1,17 @@ +package io.quarkus.it.testing.repro44320; + +import java.util.Set; + +import jakarta.enterprise.context.ApplicationScoped; + +import io.quarkus.arc.Unremovable; +import io.quarkus.runtime.Startup; + +@ApplicationScoped +@Startup +@Unremovable +public class MyService { + public Set get() { + return Set.of("a", "b", "c"); + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro13261/Repro13261Test.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro13261/Repro13261Test.java new file mode 100644 index 0000000000000..e6abb234611f7 --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro13261/Repro13261Test.java @@ -0,0 +1,24 @@ +package io.quarkus.it.main.testing.repro13261; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.nio.file.Path; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import io.quarkus.test.junit.QuarkusTest; + +@Disabled("https://github.com/quarkusio/quarkus/issues/13261") +// fails with `expected: not ` +@QuarkusTest +public class Repro13261Test { + @TempDir + Path tempDir; + + @Test + public void test() { + assertNotNull(tempDir); + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro42006/Repro42006Test.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro42006/Repro42006Test.java new file mode 100644 index 0000000000000..b0929b32df3a6 --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro42006/Repro42006Test.java @@ -0,0 +1,43 @@ +package io.quarkus.it.main.testing.repro42006; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.Serializable; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; +import org.junit.jupiter.params.provider.ArgumentsSource; + +import io.quarkus.test.junit.QuarkusTest; + +@Disabled("https://github.com/quarkusio/quarkus/issues/42006") +// fails with `java.lang.ClassNotFoundException: io.quarkus.it.main.testing.repro42006.Repro42006Test$LambdaProvider$$Lambda$4007/0x000075d5017e8450` +@QuarkusTest +public class Repro42006Test { + @ParameterizedTest + @ArgumentsSource(LambdaProvider.class) + void test(String type, Object lambda) { + assertTrue(lambda.toString().contains("$$Lambda"), "Failed on " + type); + } + + private static class LambdaProvider implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.of( + Arguments.of("SerializableSupplier", (SerializableSupplier) () -> "foo"), + Arguments.of("SerializableCustom", (SerializableCustom) () -> "bar")); + } + } + + public interface SerializableSupplier extends Supplier, Serializable { + } + + public interface SerializableCustom extends Serializable { + String get(); + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro44320/Repro44320Test.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro44320/Repro44320Test.java new file mode 100644 index 0000000000000..cb4588dbca060 --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro44320/Repro44320Test.java @@ -0,0 +1,43 @@ +package io.quarkus.it.main.testing.repro44320; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.util.HashSet; +import java.util.Set; + +import jakarta.inject.Inject; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import io.quarkus.it.testing.repro44320.MyService; +import io.quarkus.test.junit.QuarkusTest; + +@Disabled("https://github.com/quarkusio/quarkus/issues/44320") +// fails with `You must configure at least one set of arguments for this @ParameterizedTest`, because the `set` is empty +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@QuarkusTest +public class Repro44320Test { + private static Set set = new HashSet<>(); + + @Inject + MyService service; + + @BeforeAll + public void beforeAllTests() { + set = service.get(); + } + + @ParameterizedTest + @MethodSource("getData") + public void test(String key) { + assertNotNull(key); + } + + public Set getData() { + return set; + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Greeter.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Greeter.java new file mode 100644 index 0000000000000..8a410d2f0afc8 --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Greeter.java @@ -0,0 +1,5 @@ +package io.quarkus.it.main.testing.repro8446; + +public interface Greeter { + String hello(); +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/GreeterExtension.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/GreeterExtension.java new file mode 100644 index 0000000000000..05155a0bd61cb --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/GreeterExtension.java @@ -0,0 +1,52 @@ +package io.quarkus.it.main.testing.repro8446; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + +import org.junit.jupiter.api.extension.Extension; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.jupiter.api.extension.TestTemplateInvocationContext; +import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider; + +public class GreeterExtension implements TestTemplateInvocationContextProvider { + @Override + public boolean supportsTestTemplate(ExtensionContext context) { + return context.getTestMethod().map(method -> { + return Arrays.asList(method.getParameterTypes()).contains(Greeter.class); + }).orElse(false); + } + + @Override + public Stream provideTestTemplateInvocationContexts(ExtensionContext context) { + return Stream.of(new HelloTestTemplateInvocationContext(() -> "hello")); + } + + private static class HelloTestTemplateInvocationContext implements TestTemplateInvocationContext, ParameterResolver { + private final Greeter greeter; + + public HelloTestTemplateInvocationContext(Greeter greeter) { + this.greeter = greeter; + } + + @Override + public List getAdditionalExtensions() { + return Collections.singletonList(this); + } + + @Override + public boolean supportsParameter(ParameterContext pc, ExtensionContext extensionContext) + throws ParameterResolutionException { + return pc.getParameter().getType() == Greeter.class; + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { + return greeter; + } + } +} diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Repro8446Test.java b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Repro8446Test.java new file mode 100644 index 0000000000000..2edab696af117 --- /dev/null +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/testing/repro8446/Repro8446Test.java @@ -0,0 +1,20 @@ +package io.quarkus.it.main.testing.repro8446; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.ExtendWith; + +import io.quarkus.test.junit.QuarkusTest; + +@Disabled("https://github.com/quarkusio/quarkus/issues/8446") +// fails with `IllegalArgumentException: argument type mismatch` +@QuarkusTest +public class Repro8446Test { + @TestTemplate + @ExtendWith(GreeterExtension.class) + public void test(Greeter greeter) { + assertEquals("hello", greeter.hello()); + } +}