Move Mockito tests out into a separate module

Closes gh-260
This commit is contained in:
Andy Wilkinson
2025-02-27 09:55:42 +00:00
parent f2c3e52867
commit b6d60e15aa
7 changed files with 113 additions and 15 deletions

View File

@@ -0,0 +1 @@
Tests if Spring Boot's TestContext Framework's Mockito support is working

View File

@@ -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"
}
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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"
}
}
}