Skip to content

Commit 5ca3908

Browse files
committed
Add springBootStarter test
Closes gh-31
1 parent cd53755 commit 5ca3908

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

spring-boot-testjars/src/test/java/org/springframework/experimental/boot/server/exec/MavenClasspathEntryTests.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,33 @@
1616

1717
package org.springframework.experimental.boot.server.exec;
1818

19+
import java.io.File;
20+
import java.util.List;
21+
import java.util.Optional;
22+
1923
import org.junit.jupiter.api.Test;
2024

2125
import org.springframework.boot.SpringBootVersion;
2226

27+
import static org.assertj.core.api.Assertions.assertThat;
28+
2329
class MavenClasspathEntryTests {
2430

2531
@Test
26-
void go() {
27-
MavenClasspathEntry classpath = new MavenClasspathEntry(
28-
"org.springframework.boot:spring-boot-starter-oauth2-authorization-server:"
29-
+ SpringBootVersion.getVersion());
30-
classpath.resolve();
32+
void springBootStarter() {
33+
MavenClasspathEntry classpath = MavenClasspathEntry.springBootStarter("web");
34+
List<String> entries = classpath.resolve();
35+
assertThat(entries).hasSizeGreaterThan(5);
36+
String mavenLocal = new File(System.getProperty("user.home"), ".m2/repository").getAbsolutePath();
37+
entries.forEach((entry) -> assertThat(entry).startsWith(mavenLocal));
38+
String starterWebPathPartial = "/org/springframework/boot/spring-boot-starter-web/"
39+
+ SpringBootVersion.getVersion() + "/spring-boot-starter-web-" + SpringBootVersion.getVersion()
40+
+ ".jar";
41+
Optional<String> starterWebEntry = entries.stream().filter((entry) -> entry.contains(starterWebPathPartial))
42+
.findFirst();
43+
assertThat(starterWebEntry.isPresent())
44+
.withFailMessage("Unable to find spring-boot-starter with path that contains " + starterWebPathPartial)
45+
.isTrue();
3146
}
3247

3348
}

0 commit comments

Comments
 (0)