mirror of
https://gitee.com/dcren/initializr.git
synced 2026-09-19 06:17:42 +08:00
Polish "Add spring-batch-test when Spring Batch is selected"
Closes gh-516
This commit is contained in:
+1
@@ -21,6 +21,7 @@ import io.spring.initializr.generator.ProjectRequestPostProcessor;
|
|||||||
import io.spring.initializr.metadata.Dependency;
|
import io.spring.initializr.metadata.Dependency;
|
||||||
import io.spring.initializr.metadata.InitializrMetadata;
|
import io.spring.initializr.metadata.InitializrMetadata;
|
||||||
import io.spring.initializr.util.Version;
|
import io.spring.initializr.util.Version;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+34
-25
@@ -26,33 +26,42 @@ import org.junit.Test;
|
|||||||
* @author Tim Riemer
|
* @author Tim Riemer
|
||||||
*/
|
*/
|
||||||
public class SpringBatchTestRequestPostProcessorTests
|
public class SpringBatchTestRequestPostProcessorTests
|
||||||
extends AbstractRequestPostProcessorTests {
|
extends AbstractRequestPostProcessorTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void batchTestIsAddedWithBatch() {
|
public void batchTestIsAddedWithBatch() {
|
||||||
ProjectRequest request = createProjectRequest("batch");
|
ProjectRequest request = createProjectRequest("batch");
|
||||||
generateMavenPom(request)
|
generateMavenPom(request)
|
||||||
.hasSpringBootStarterDependency("batch")
|
.hasSpringBootStarterDependency("batch")
|
||||||
.hasSpringBootStarterTest()
|
.hasSpringBootStarterTest()
|
||||||
.hasDependency(springBatchTest())
|
.hasDependency(springBatchTest())
|
||||||
.hasDependenciesCount(3);
|
.hasDependenciesCount(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void batchTestIsNotAddedBefore13() {
|
public void batchTestIsNotAddedBefore13() {
|
||||||
ProjectRequest request = createProjectRequest("batch");
|
ProjectRequest request = createProjectRequest("batch");
|
||||||
request.setBootVersion("1.2.7.RELEASE");
|
request.setBootVersion("1.2.7.RELEASE");
|
||||||
generateMavenPom(request)
|
generateMavenPom(request)
|
||||||
.hasSpringBootStarterDependency("batch")
|
.hasSpringBootStarterDependency("batch")
|
||||||
.hasSpringBootStarterTest()
|
.hasSpringBootStarterTest()
|
||||||
.hasDependenciesCount(2);
|
.hasDependenciesCount(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dependency springBatchTest() {
|
@Test
|
||||||
Dependency dependency = Dependency.withId("spring-batch-test",
|
public void batchTestIsNotAddedWithoutSpringBatch() {
|
||||||
"org.springframework.batch", "spring-batch-test");
|
ProjectRequest request = createProjectRequest("web");
|
||||||
dependency.setScope(Dependency.SCOPE_TEST);
|
generateMavenPom(request)
|
||||||
return dependency;
|
.hasSpringBootStarterDependency("web")
|
||||||
}
|
.hasSpringBootStarterTest()
|
||||||
|
.hasDependenciesCount(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dependency springBatchTest() {
|
||||||
|
Dependency dependency = Dependency.withId("spring-batch-test",
|
||||||
|
"org.springframework.batch", "spring-batch-test");
|
||||||
|
dependency.setScope(Dependency.SCOPE_TEST);
|
||||||
|
return dependency;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user