Skip to content

Commit 7a5790e

Browse files
authored
Merge pull request #17 from aureamunoz/sb-test
Provide a custom @SpringBootTest to avoid ClassNotFoundException and reduce dependency footprint
2 parents 1f3a54f + 8394496 commit 7a5790e

File tree

6 files changed

+91
-13
lines changed

6 files changed

+91
-13
lines changed

pom.xml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>io.quarkus</groupId>
6-
<artifactId>quarkus-spring-boot-test-api</artifactId>
6+
<artifactId>quarkus-spring-test-api</artifactId>
77
<version>3.5.Alpha1-SNAPSHOT</version>
88

9-
<name>Spring Boot dependencies for Quarkus</name>
9+
<name>Spring Test dependencies for Quarkus</name>
1010
<description>The minimum dependencies to reduce the footprint of Quarkus applications using the Spring Boot features</description>
1111
<url>https://quarkus.io/</url>
1212
<developers>
@@ -43,12 +43,14 @@
4343
<maven.compiler.source>17</maven.compiler.source>
4444
<maven.compiler.target>17</maven.compiler.target>
4545
<spring-boot-test.version>3.5.7</spring-boot-test.version>
46+
<spring-test.version>6.2.12</spring-test.version>
47+
<quarkus-junit.version>3.32.3</quarkus-junit.version>
4648
</properties>
4749

4850
<packaging>pom</packaging>
4951
<modules>
50-
<module>quarkus-spring-boot-test-core-api</module>
51-
<!-- <module>quarkus-spring-boot-properties-api</module>-->
52+
<module>quarkus-spring-boot-test-api</module>
53+
<module>quarkus-spring-test-core-api</module>
5254
</modules>
5355

5456

@@ -59,6 +61,16 @@
5961
<artifactId>spring-boot-test</artifactId>
6062
<version>${spring-boot-test.version}</version>
6163
</dependency>
64+
<dependency>
65+
<groupId>org.springframework</groupId>
66+
<artifactId>spring-test</artifactId>
67+
<version>${spring-test.version}</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>io.quarkus</groupId>
71+
<artifactId>quarkus-junit</artifactId>
72+
<version>${quarkus-junit.version}</version>
73+
</dependency>
6274
</dependencies>
6375
</dependencyManagement>
6476

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>io.quarkus</groupId>
7+
<artifactId>quarkus-spring-test-api</artifactId>
8+
<version>3.5.Alpha1-SNAPSHOT</version>
9+
<relativePath>../</relativePath>
10+
</parent>
11+
12+
<groupId>io.quarkus</groupId>
13+
<artifactId>quarkus-spring-boot-test-api</artifactId>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.quarkus</groupId>
18+
<artifactId>quarkus-junit</artifactId>
19+
<scope>provided</scope>
20+
</dependency>
21+
</dependencies>
22+
23+
</project>

quarkus-spring-boot-test-core-api/src/main/java/Dummy.java renamed to quarkus-spring-boot-test-api/src/main/java/Dummy.java

File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.test.context;
18+
19+
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Inherited;
22+
import java.lang.annotation.Retention;
23+
import java.lang.annotation.RetentionPolicy;
24+
import java.lang.annotation.Target;
25+
26+
import org.junit.jupiter.api.extension.ExtendWith;
27+
28+
import io.quarkus.test.junit.QuarkusTestExtension;
29+
30+
@Target(ElementType.TYPE)
31+
@Retention(RetentionPolicy.RUNTIME)
32+
@Documented
33+
@Inherited
34+
@ExtendWith(QuarkusTestExtension.class)
35+
public @interface SpringBootTest {
36+
37+
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
<parent>
66
<groupId>io.quarkus</groupId>
7-
<artifactId>quarkus-spring-boot-test-api</artifactId>
7+
<artifactId>quarkus-spring-test-api</artifactId>
88
<version>3.5.Alpha1-SNAPSHOT</version>
9+
<relativePath>../</relativePath>
910
</parent>
1011

1112
<groupId>io.quarkus</groupId>
12-
<artifactId>quarkus-spring-boot-test-core-api</artifactId>
13-
<version>3.5.Alpha1-SNAPSHOT</version>
13+
<artifactId>quarkus-spring-test-core-api</artifactId>
1414

1515
<dependencies>
1616
<dependency>
17-
<groupId>org.springframework.boot</groupId>
18-
<artifactId>spring-boot-test</artifactId>
17+
<groupId>org.springframework</groupId>
18+
<artifactId>spring-test</artifactId>
1919
</dependency>
2020
</dependencies>
2121

@@ -35,15 +35,14 @@
3535
<createSourcesJar>true</createSourcesJar>
3636
<artifactSet>
3737
<includes>
38-
<include>org.springframework.boot:spring-boot-test</include>
38+
<include>org.springframework:spring-test</include>
3939
</includes>
4040
</artifactSet>
4141
<filters>
4242
<filter>
43-
<artifact>org.springframework.boot:spring-boot-test</artifact>
43+
<artifact>org.springframework:spring-test</artifact>
4444
<includes>
45-
<!-- Used in Quarkus -->
46-
<include>org/springframework/boot/test/context/SpringBootTest**</include>
45+
<include>org/springframework/test/context/junit/jupiter/SpringExtension**</include>
4746
</includes>
4847
</filter>
4948
</filters>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/***
2+
* Dummy class for javadoc
3+
*
4+
*/
5+
6+
public class Dummy {
7+
}

0 commit comments

Comments
 (0)