Skip to content

Commit

Permalink
Move Mockito tests out into a separate module
Browse files Browse the repository at this point in the history
Closes gh-260
  • Loading branch information
wilkinsona committed Feb 27, 2025
1 parent f2c3e52 commit b6d60e1
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 15 deletions.
1 change: 1 addition & 0 deletions boot/boot-tcf-mockito/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tests if Spring Boot's TestContext Framework's Mockito support is working
28 changes: 28 additions & 0 deletions boot/boot-tcf-mockito/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -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();

}
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand Down
13 changes: 0 additions & 13 deletions boot/boot-tcf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit b6d60e1

Please sign in to comment.