/
CommandLineExampleIntegrationTests.java
72 lines (63 loc) · 2.57 KB
/
CommandLineExampleIntegrationTests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright 2012-2017 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
*
* http://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 io.spring.initializr.web.project;
import io.spring.initializr.test.generator.PomAssert;
import io.spring.initializr.web.AbstractInitializrControllerIntegrationTests;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
/**
* Validate that the "raw" HTTP commands that are described in the command-line help
* works. If anything needs to be updated here, please double check the
* "curl-examples.txt" as it may need an update as well. This is also a good indicator of
* a non backward compatible change.
*
* @author Stephane Nicoll
*/
@ActiveProfiles("test-default")
public class CommandLineExampleIntegrationTests
extends AbstractInitializrControllerIntegrationTests {
@Test
public void generateDefaultProject() {
downloadZip("/starter.zip").isJavaProject().isMavenProject()
.hasStaticAndTemplatesResources(false).pomAssert()
.hasSpringBootStarterRootDependency().hasSpringBootStarterTest()
.hasDependenciesCount(2);
}
@Test
public void generateWebProjectWithJava8() {
downloadZip("/starter.zip?dependencies=web&javaVersion=1.8").isJavaProject()
.isMavenProject().hasStaticAndTemplatesResources(true).pomAssert()
.hasJavaVersion("1.8").hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
@Test
public void generateWebDataJpaGradleProject() {
downloadTgz(
"/starter.tgz?dependencies=web,data-jpa&type=gradle-project&baseDir=my-dir")
.hasBaseDir("my-dir").isJavaProject().isGradleProject()
.hasStaticAndTemplatesResources(true).gradleBuildAssert()
.contains("spring-boot-starter-web")
.contains("spring-boot-starter-data-jpa");
}
@Test
public void generateMavenPomWithWarPackaging() {
ResponseEntity<String> response = getRestTemplate()
.getForEntity(createUrl("/pom.xml?packaging=war"), String.class);
PomAssert pomAssert = new PomAssert(response.getBody());
pomAssert.hasPackaging("war");
}
}