diff --git a/boot/boot-tcf-mockito/README.adoc b/boot/boot-tcf-mockito/README.adoc new file mode 100644 index 00000000..46bf59d5 --- /dev/null +++ b/boot/boot-tcf-mockito/README.adoc @@ -0,0 +1 @@ +Tests if Spring Boot's TestContext Framework's Mockito support is working \ No newline at end of file diff --git a/boot/boot-tcf-mockito/build.gradle b/boot/boot-tcf-mockito/build.gradle new file mode 100644 index 00000000..a3e38e5c --- /dev/null +++ b/boot/boot-tcf-mockito/build.gradle @@ -0,0 +1,28 @@ +plugins { + id "java" + id "org.springframework.boot" + id "org.springframework.aot.smoke-test" + id "org.graalvm.buildtools.native" +} + +dependencies { + implementation(enforcedPlatform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) + implementation("org.springframework.boot:spring-boot-starter") + + testImplementation("org.springframework.boot:spring-boot-starter-test") + + appTestImplementation(project(":aot-smoke-test-support")) +} + +aotSmokeTest { + nativeTest { + expectedToFail { + becauseOf "https://github.com/spring-projects/spring-boot/issues/32195" + } + } + test { + expectedToFail { + becauseOf "https://github.com/spring-projects/spring-boot/issues/32195" + } + } +} diff --git a/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/BootTcfMockitoApplication.java b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/BootTcfMockitoApplication.java new file mode 100644 index 00000000..86edc386 --- /dev/null +++ b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/BootTcfMockitoApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.boot.tcf.mockito; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BootTcfMockitoApplication { + + public static void main(String[] args) { + SpringApplication application = new SpringApplication(BootTcfMockitoApplication.class); + System.setProperty("main.ran", "true"); + application.run(args); + } + +} diff --git a/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentImpl.java b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentImpl.java new file mode 100644 index 00000000..91bc4355 --- /dev/null +++ b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentImpl.java @@ -0,0 +1,28 @@ +/* + * Copyright 2022-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.boot.tcf.mockito; + +import org.springframework.stereotype.Component; + +@Component +class MyComponentImpl { + + int value() { + return 1; + } + +} diff --git a/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentInterface.java b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentInterface.java new file mode 100644 index 00000000..5b3f23d4 --- /dev/null +++ b/boot/boot-tcf-mockito/src/main/java/com/example/boot/tcf/mockito/MyComponentInterface.java @@ -0,0 +1,23 @@ +/* + * Copyright 2022-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.boot.tcf.mockito; + +interface MyComponentInterface { + + int value(); + +} diff --git a/boot/boot-tcf/src/test/java/com/example/boot/tcf/MockBeanTests.java b/boot/boot-tcf-mockito/src/test/java/com/example/boot/tcf/mockito/MockBeanTests.java similarity index 93% rename from boot/boot-tcf/src/test/java/com/example/boot/tcf/MockBeanTests.java rename to boot/boot-tcf-mockito/src/test/java/com/example/boot/tcf/mockito/MockBeanTests.java index 112e3dd0..4498ed80 100644 --- a/boot/boot-tcf/src/test/java/com/example/boot/tcf/MockBeanTests.java +++ b/boot/boot-tcf-mockito/src/test/java/com/example/boot/tcf/mockito/MockBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.boot.tcf; +package com.example.boot.tcf.mockito; import org.junit.jupiter.api.Test; import org.mockito.Mockito; diff --git a/boot/boot-tcf/build.gradle b/boot/boot-tcf/build.gradle index e41f6fc0..d73d9f4f 100644 --- a/boot/boot-tcf/build.gradle +++ b/boot/boot-tcf/build.gradle @@ -14,16 +14,3 @@ dependencies { appTestImplementation(project(":aot-smoke-test-support")) appTestImplementation("org.awaitility:awaitility:4.2.0") } - -aotSmokeTest { - nativeTest { - expectedToFail { - becauseOf "https://github.com/spring-projects/spring-boot/issues/32195" - } - } - test { - expectedToFail { - becauseOf "https://github.com/spring-projects/spring-boot/issues/32195" - } - } -}