Polish contribution

Closes gh-655
This commit is contained in:
Stephane Nicoll
2018-04-16 16:21:30 +02:00
parent 593759f321
commit 432be66c5a
11 changed files with 18 additions and 22 deletions

View File

@@ -106,6 +106,7 @@ public abstract class AbstractInitializrIntegrationTests {
protected void validateContentType(ResponseEntity<String> response,
MediaType expected) {
MediaType actual = response.getHeaders().getContentType();
assertThat(actual).isNotNull();
assertThat(actual.isCompatibleWith(expected))
.as("Non compatible media-type, expected " + expected + ", got " + actual)
.isTrue();

View File

@@ -72,8 +72,8 @@ public class InitializrMetadataJsonMapperTests {
int first = json.indexOf("https://example.com/how-to");
int second = json.indexOf("https://example.com/doc");
// JSON objects are not ordered
assertThat(first > 0).isTrue();
assertThat(second > 0).isTrue();
assertThat(first).isGreaterThan(0);
assertThat(second).isGreaterThan(0);
}
private Object get(JsonNode result, String path) {

View File

@@ -83,7 +83,7 @@ public class LinkMapperTests {
links.add(Link.create("second", "https://example.com"));
ObjectNode model = LinkMapper.mapLinks(links);
String json = model.toString();
assertThat(json.indexOf("first") < json.indexOf("second")).isTrue();
assertThat(json.indexOf("first")).isLessThan(json.indexOf("second"));
}
@Test
@@ -94,7 +94,7 @@ public class LinkMapperTests {
links.add(Link.create("first", "https://example.com"));
ObjectNode model = LinkMapper.mapLinks(links);
String json = model.toString();
assertThat(json.indexOf("first") < json.indexOf("second")).isTrue();
assertThat(json.indexOf("first")).isLessThan(json.indexOf("second"));
}
}

View File

@@ -46,12 +46,11 @@ public class MainControllerDefaultsIntegrationTests
@Test
public void defaultsAppliedToHome() {
String body = htmlHome();
assertThat(body.contains("org.foo")).as("custom groupId not found").isTrue();
assertThat(body.contains("foo-bar")).as("custom artifactId not found").isTrue();
assertThat(body.contains("FooBar")).as("custom name not found").isTrue();
assertThat(body.contains("FooBar Project")).as("custom description not found")
.isTrue();
assertThat(body.contains("org.foo.demo")).as("custom package not found").isTrue();
assertThat(body).as("custom groupId not found").contains("org.foo");
assertThat(body).as("custom artifactId not found").contains("foo-bar");
assertThat(body).as("custom name not found").contains("FooBar");
assertThat(body).as("custom description not found").contains("FooBar Project");
assertThat(body).as("custom package not found").contains("org.foo.demo");
}
}

View File

@@ -48,9 +48,8 @@ public class MainControllerEnvIntegrationTests
public void doNotForceSsl() {
ResponseEntity<String> response = invokeHome("curl/1.2.4", "*/*");
String body = response.getBody();
assertThat(body.contains("http://start.spring.io/")).as("Must not force https")
.isTrue();
assertThat(body.contains("https://")).as("Must not force https").isFalse();
assertThat(body).as("Must not force https").contains("http://start.spring.io/");
assertThat(body).as("Must not force https").doesNotContain("https://");
}
@Test

View File

@@ -406,7 +406,7 @@ public class MainControllerIntegrationTests
byte[] body = getRestTemplate().getForObject(createUrl("starter.zip"),
byte[].class);
assertThat(body).isNotNull();
assertThat(body.length > 100).isTrue();
assertThat(body.length).isGreaterThan(100);
}
@Test

View File

@@ -374,7 +374,7 @@ public class ProjectGenerationSmokeTests
private File getArchive(String fileName) {
File archive = new File(this.downloadDir, fileName);
assertThat(archive.exists()).isTrue();
assertThat(archive).exists();
return archive;
}