mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 05:32:58 +08:00
Upgrade test infrastructure to more recent Spring Boot versions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -85,7 +85,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void dependencyInRange() {
|
||||
Dependency biz = Dependency.create("org.acme", "biz", "1.3.5", "runtime");
|
||||
ProjectStructure project = downloadTgz("/starter.tgz?dependencies=org.acme:biz&bootVersion=2.2.1.RELEASE");
|
||||
ProjectStructure project = downloadTgz("/starter.tgz?dependencies=org.acme:biz&bootVersion=2.5.1");
|
||||
assertDefaultProject(project);
|
||||
assertDoesNotHaveWebResources(project);
|
||||
assertThat(project).mavenBuild().hasDependenciesSize(3).hasDependency(biz);
|
||||
|
||||
@@ -111,11 +111,11 @@ class ProjectMetadataControllerCustomDefaultsIntegrationTests extends AbstractFu
|
||||
|
||||
@Test
|
||||
void filteredDependencies() throws JSONException {
|
||||
ResponseEntity<String> response = execute("/dependencies?bootVersion=2.4.1.RELEASE", String.class, null,
|
||||
ResponseEntity<String> response = execute("/dependencies?bootVersion=2.5.1", String.class, null,
|
||||
"application/json");
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
validateContentType(response, DEFAULT_METADATA_MEDIA_TYPE);
|
||||
validateDependenciesOutput("2.4.1", response.getBody());
|
||||
validateDependenciesOutput("2.5.1", response.getBody());
|
||||
}
|
||||
|
||||
protected void validateDependenciesOutput(String version, String actual) throws JSONException {
|
||||
|
||||
@@ -75,12 +75,12 @@ public class ProjectMetadataControllerIntegrationTests extends AbstractInitializ
|
||||
@Test
|
||||
void metadataWithInvalidPlatformVersion() {
|
||||
try {
|
||||
execute("/dependencies?bootVersion=1.5.17.RELEASE", String.class, "application/vnd.initializr.v2.1+json",
|
||||
execute("/dependencies?bootVersion=2.2.17.RELEASE", String.class, "application/vnd.initializr.v2.1+json",
|
||||
"application/json");
|
||||
}
|
||||
catch (HttpClientErrorException ex) {
|
||||
assertThat(ex.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
assertThat(ex.getResponseBodyAsString().contains("1.5.17.RELEASE"));
|
||||
assertThat(ex.getResponseBodyAsString().contains("2.2.17.RELEASE"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,14 +131,14 @@ class DefaultProjectRequestToDescriptionConverterTests {
|
||||
@Test
|
||||
void convertWhenDependencyOutOfRangeShouldThrowException() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setRange(new VersionRange(Version.parse("2.2.0.M1")));
|
||||
dependency.setRange(new VersionRange(Version.parse("2.5.0.M1")));
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults().addDependencyGroup("foo", dependency)
|
||||
.build();
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setDependencies(Collections.singletonList("foo"));
|
||||
assertThatExceptionOfType(InvalidProjectRequestException.class)
|
||||
.isThrownBy(() -> this.converter.convert(request, metadata))
|
||||
.withMessage("Dependency 'foo' is not compatible " + "with Spring Boot 2.1.1.RELEASE");
|
||||
.withMessage("Dependency 'foo' is not compatible " + "with Spring Boot 2.4.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class MetadataProjectDescriptionCustomizerTests {
|
||||
|
||||
private InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults().build();
|
||||
private final InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults().build();
|
||||
|
||||
@Test
|
||||
void customizeShouldUseDefaultApplicationNameFromMetadata() {
|
||||
@@ -47,8 +47,7 @@ class MetadataProjectDescriptionCustomizerTests {
|
||||
|
||||
@Test
|
||||
void customizeShouldUseDefaultPlatformVersionFromMetadata() {
|
||||
assertThat(customize(new MutableProjectDescription()).getPlatformVersion())
|
||||
.isEqualTo(Version.parse("2.1.1.RELEASE"));
|
||||
assertThat(customize(new MutableProjectDescription()).getPlatformVersion()).isEqualTo(Version.parse("2.4.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -85,7 +85,7 @@ initializr:
|
||||
artifactId: biz
|
||||
scope: runtime
|
||||
version: 1.3.5
|
||||
compatibilityRange: 2.2.0.BUILD-SNAPSHOT
|
||||
compatibilityRange: 2.5.0-SNAPSHOT
|
||||
- name: Bur
|
||||
id: org.acme:bur
|
||||
version: 2.1.0
|
||||
@@ -158,7 +158,7 @@ initializr:
|
||||
id: 2.1.4.RELEASE
|
||||
default: true
|
||||
- name: 1.5.17
|
||||
id: 1.5.17.RELEASE
|
||||
id: 2.2.17.RELEASE
|
||||
default: false
|
||||
|
||||
server:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
],
|
||||
@@ -224,7 +224,7 @@
|
||||
"name": "Biz",
|
||||
"scope": "runtime",
|
||||
"version": "1.3.5",
|
||||
"compatibilityRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
"compatibilityRange": "2.5.0-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"starter": true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"bootVersion": "2.4.1.RELEASE",
|
||||
"bootVersion": "2.5.1",
|
||||
"repositories": {
|
||||
"my-api-repo-2": {
|
||||
"name": "repo2",
|
||||
@@ -162,7 +162,7 @@
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
{
|
||||
"id": "org.acme:biz",
|
||||
"name": "Biz",
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.5.0.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "org.acme:bur",
|
||||
@@ -200,7 +200,7 @@
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
{
|
||||
"id": "org.acme:biz",
|
||||
"name": "Biz",
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.5.0.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "org.acme:bur",
|
||||
@@ -200,7 +200,7 @@
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
{
|
||||
"id": "org.acme:biz",
|
||||
"name": "Biz",
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.5.0-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "org.acme:bur",
|
||||
@@ -200,7 +200,7 @@
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.5.17.RELEASE",
|
||||
"id": "2.2.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user