Skip to content

Commit 0c74b3c

Browse files
committed
Format deployment integration test source code
Closes gh-17077
1 parent 8f1be4c commit 0c74b3c

File tree

5 files changed

+26
-49
lines changed

5 files changed

+26
-49
lines changed

spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,8 +35,7 @@ public class SampleGlassfishDeployApplicationIT {
3535
public void testHome() throws Exception {
3636
String url = "http://localhost:" + this.port + "/bootapp/";
3737
System.out.println(url);
38-
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
39-
String.class);
38+
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
4039
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
4140
assertThat(entity.getBody()).isEqualTo("Hello World");
4241
}

spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,70 +46,51 @@ public void testHome() throws Exception {
4646
}
4747

4848
@Test
49-
public void errorFromExceptionForRequestAcceptingAnythingProducesAJsonResponse()
50-
throws Exception {
51-
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.ALL,
52-
MediaType.APPLICATION_JSON);
49+
public void errorFromExceptionForRequestAcceptingAnythingProducesAJsonResponse() throws Exception {
50+
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.ALL, MediaType.APPLICATION_JSON);
5351
}
5452

5553
@Test
56-
public void errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse()
57-
throws Exception {
58-
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.APPLICATION_JSON,
59-
MediaType.APPLICATION_JSON);
54+
public void errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse() throws Exception {
55+
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
6056
}
6157

6258
@Test
63-
public void errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse()
64-
throws Exception {
65-
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.TEXT_HTML,
66-
MediaType.TEXT_HTML);
59+
public void errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse() throws Exception {
60+
assertThatErrorFromExceptionProducesExpectedResponse(MediaType.TEXT_HTML, MediaType.TEXT_HTML);
6761
}
6862

6963
@Test
70-
public void sendErrorForRequestAcceptingAnythingProducesAJsonResponse()
71-
throws Exception {
72-
assertThatSendErrorProducesExpectedResponse(MediaType.ALL,
73-
MediaType.APPLICATION_JSON);
64+
public void sendErrorForRequestAcceptingAnythingProducesAJsonResponse() throws Exception {
65+
assertThatSendErrorProducesExpectedResponse(MediaType.ALL, MediaType.APPLICATION_JSON);
7466
}
7567

7668
@Test
7769
public void sendErrorForRequestAcceptingJsonProducesAJsonResponse() throws Exception {
78-
assertThatSendErrorProducesExpectedResponse(MediaType.APPLICATION_JSON,
79-
MediaType.APPLICATION_JSON);
70+
assertThatSendErrorProducesExpectedResponse(MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
8071
}
8172

8273
@Test
83-
public void sendErrorForRequestAcceptingHtmlProducesAnHtmlResponse()
84-
throws Exception {
85-
assertThatSendErrorProducesExpectedResponse(MediaType.TEXT_HTML,
86-
MediaType.TEXT_HTML);
74+
public void sendErrorForRequestAcceptingHtmlProducesAnHtmlResponse() throws Exception {
75+
assertThatSendErrorProducesExpectedResponse(MediaType.TEXT_HTML, MediaType.TEXT_HTML);
8776
}
8877

89-
private void assertThatSendErrorProducesExpectedResponse(MediaType accept,
90-
MediaType contentType) {
78+
private void assertThatSendErrorProducesExpectedResponse(MediaType accept, MediaType contentType) {
9179
RequestEntity<Void> request = RequestEntity
92-
.get(URI.create("http://localhost:" + this.port + "/bootapp/send-error"))
93-
.accept(accept).build();
80+
.get(URI.create("http://localhost:" + this.port + "/bootapp/send-error")).accept(accept).build();
9481
ResponseEntity<String> response = this.rest.exchange(request, String.class);
9582
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
9683
assertThat(contentType.isCompatibleWith(response.getHeaders().getContentType()))
97-
.as("%s is compatible with %s", contentType,
98-
response.getHeaders().getContentType())
99-
.isTrue();
84+
.as("%s is compatible with %s", contentType, response.getHeaders().getContentType()).isTrue();
10085
}
10186

102-
private void assertThatErrorFromExceptionProducesExpectedResponse(MediaType accept,
103-
MediaType contentType) {
87+
private void assertThatErrorFromExceptionProducesExpectedResponse(MediaType accept, MediaType contentType) {
10488
RequestEntity<Void> request = RequestEntity
105-
.get(URI.create("http://localhost:" + this.port + "/bootapp/exception"))
106-
.accept(accept).build();
89+
.get(URI.create("http://localhost:" + this.port + "/bootapp/exception")).accept(accept).build();
10790
ResponseEntity<String> response = this.rest.exchange(request, String.class);
10891
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
10992
assertThat(contentType.isCompatibleWith(response.getHeaders().getContentType()))
110-
.as("%s is compatible with %s", contentType,
111-
response.getHeaders().getContentType())
112-
.isTrue();
93+
.as("%s is compatible with %s", contentType, response.getHeaders().getContentType()).isTrue();
11394
}
11495

11596
}

spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,8 +34,7 @@ public class SampleTomEEDeployApplicationIT {
3434
@Test
3535
public void testHome() throws Exception {
3636
String url = "http://localhost:" + this.port + "/bootapp/";
37-
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
38-
String.class);
37+
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
3938
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
4039
assertThat(entity.getBody()).isEqualTo("Hello World");
4140
}

spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,8 +34,7 @@ public class SampleWildFlyDeployApplicationIT {
3434
@Test
3535
public void testHome() throws Exception {
3636
String url = "http://localhost:" + this.port + "/bootapp/";
37-
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
38-
String.class);
37+
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
3938
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
4039
assertThat(entity.getBody()).isEqualTo("Hello World");
4140
}

spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,8 +34,7 @@ public class SampleWlpDeployApplicationIT {
3434
@Test
3535
public void testHome() throws Exception {
3636
String url = "http://localhost:" + this.port + "/bootapp/";
37-
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
38-
String.class);
37+
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
3938
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
4039
assertThat(entity.getBody()).isEqualTo("Hello World");
4140
}

0 commit comments

Comments
 (0)