mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 23:13:30 +08:00
Add missing test for JUnit 4 exclusion
See gh-905
This commit is contained in:
parent
6c79192e75
commit
1c7a73c29f
@ -164,6 +164,31 @@ class GradleProjectGenerationConfigurationTests {
|
|||||||
assertThat(lines).doesNotContainSequence("test {", " useJUnitPlatform()", "}");
|
assertThat(lines).doesNotContainSequence("test {", " useJUnitPlatform()", "}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testStarterExcludesVintageEngineAndJUnitWithCompatibleVersion() {
|
||||||
|
ProjectDescription description = new ProjectDescription();
|
||||||
|
description.setPlatformVersion(Version.parse("2.2.0.M4"));
|
||||||
|
description.setLanguage(new JavaLanguage());
|
||||||
|
ProjectStructure projectStructure = this.projectTester.generate(description);
|
||||||
|
assertThat(projectStructure.getRelativePathsOfProjectFiles()).contains("build.gradle");
|
||||||
|
List<String> lines = projectStructure.readAllLines("build.gradle");
|
||||||
|
assertThat(lines).containsSequence(
|
||||||
|
" testImplementation('org.springframework.boot:spring-boot-starter-test') {",
|
||||||
|
" exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'",
|
||||||
|
" exclude group: 'junit', module: 'junit'", " }");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testStarterDoesNotExcludesVintageEngineAndJUnitWithIncompatibleVersion() {
|
||||||
|
ProjectDescription description = new ProjectDescription();
|
||||||
|
description.setPlatformVersion(Version.parse("2.1.6.RELEASE"));
|
||||||
|
description.setLanguage(new JavaLanguage());
|
||||||
|
ProjectStructure projectStructure = this.projectTester.generate(description);
|
||||||
|
assertThat(projectStructure.getRelativePathsOfProjectFiles()).contains("build.gradle");
|
||||||
|
List<String> lines = projectStructure.readAllLines("build.gradle");
|
||||||
|
assertThat(lines).doesNotContain("exclude group");
|
||||||
|
}
|
||||||
|
|
||||||
static Stream<Arguments> annotationProcessorScopeBuildParameters() {
|
static Stream<Arguments> annotationProcessorScopeBuildParameters() {
|
||||||
return Stream.of(Arguments.arguments("1.5.17.RELEASE", false), Arguments.arguments("2.0.6.RELEASE", true),
|
return Stream.of(Arguments.arguments("1.5.17.RELEASE", false), Arguments.arguments("2.0.6.RELEASE", true),
|
||||||
Arguments.arguments("2.1.3.RELEASE", true));
|
Arguments.arguments("2.1.3.RELEASE", true));
|
||||||
|
@ -95,4 +95,31 @@ class MavenProjectGenerationConfigurationTests {
|
|||||||
assertThat(lines).containsOnlyOnce(" <packaging>war</packaging>");
|
assertThat(lines).containsOnlyOnce(" <packaging>war</packaging>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testStarterExcludesVintageEngineAndJUnitWithCompatibleVersion() {
|
||||||
|
ProjectDescription description = new ProjectDescription();
|
||||||
|
description.setPlatformVersion(Version.parse("2.2.0.M4"));
|
||||||
|
description.setLanguage(new JavaLanguage());
|
||||||
|
ProjectStructure projectStructure = this.projectTester.generate(description);
|
||||||
|
assertThat(projectStructure.getRelativePathsOfProjectFiles()).contains("pom.xml");
|
||||||
|
List<String> lines = projectStructure.readAllLines("pom.xml");
|
||||||
|
assertThat(lines).containsSequence(" <exclusions>", " <exclusion>",
|
||||||
|
" <groupId>org.junit.vintage</groupId>",
|
||||||
|
" <artifactId>junit-vintage-engine</artifactId>", " </exclusion>",
|
||||||
|
" <exclusion>", " <groupId>junit</groupId>",
|
||||||
|
" <artifactId>junit</artifactId>", " </exclusion>",
|
||||||
|
" </exclusions>");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testStarterDoesNotExcludesVintageEngineAndJUnitWithIncompatibleVersion() {
|
||||||
|
ProjectDescription description = new ProjectDescription();
|
||||||
|
description.setPlatformVersion(Version.parse("2.1.6.RELEASE"));
|
||||||
|
description.setLanguage(new JavaLanguage());
|
||||||
|
ProjectStructure projectStructure = this.projectTester.generate(description);
|
||||||
|
assertThat(projectStructure.getRelativePathsOfProjectFiles()).contains("pom.xml");
|
||||||
|
List<String> lines = projectStructure.readAllLines("pom.xml");
|
||||||
|
assertThat(lines).doesNotContain(" <exclusions>");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user