This commit is contained in:
Stephane Nicoll
2017-12-12 11:57:24 +01:00
parent 97c91eee94
commit 23218add90
615 changed files with 2832 additions and 3224 deletions

View File

@@ -16,8 +16,6 @@
package sample.activemq;
import javax.jms.JMSException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,7 +43,7 @@ public class SampleActiveMqTests {
private Producer producer;
@Test
public void sendSimpleMessage() throws InterruptedException, JMSException {
public void sendSimpleMessage() throws InterruptedException {
this.producer.send("Test message");
Thread.sleep(1000L);
assertThat(this.outputCapture.toString().contains("Test message")).isTrue();

View File

@@ -54,7 +54,7 @@ public class CorsSampleActuatorApplicationTests {
private ApplicationContext applicationContext;
@Before
public void setUp() throws Exception {
public void setUp() {
RestTemplate restTemplate = new RestTemplate();
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(
this.applicationContext.getEnvironment(), "http");
@@ -64,7 +64,7 @@ public class CorsSampleActuatorApplicationTests {
}
@Test
public void endpointShouldReturnUnauthorized() throws Exception {
public void endpointShouldReturnUnauthorized() {
ResponseEntity<?> entity = this.testRestTemplate.getForEntity("/actuator/env",
Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);

View File

@@ -48,7 +48,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
private int managementPort = 9011;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = new TestRestTemplate("user", "password")
.getForEntity("http://localhost:" + this.port, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -56,7 +56,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testSecureActuator() throws Exception {
public void testSecureActuator() {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/management/actuator/env",
String.class);
@@ -64,7 +64,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testInsecureActuator() throws Exception {
public void testInsecureActuator() {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/management/actuator/health",
String.class);
@@ -73,7 +73,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testMissing() throws Exception {
public void testMissing() {
ResponseEntity<String> entity = new TestRestTemplate("admin", "admin")
.getForEntity("http://localhost:" + this.managementPort
+ "/management/actuator/missing", String.class);

View File

@@ -41,7 +41,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void homeIsSecure() throws Exception {
public void homeIsSecure() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
@@ -52,7 +52,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
}
@Test
public void testInsecureApplicationPath() throws Exception {
public void testInsecureApplicationPath() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/foo", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
@@ -63,7 +63,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
}
@Test
public void testInsecureStaticResources() throws Exception {
public void testInsecureStaticResources() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -71,7 +71,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
}
@Test
public void insecureActuator() throws Exception {
public void insecureActuator() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/actuator/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -79,7 +79,7 @@ public class SampleActuatorCustomSecurityApplicationTests {
}
@Test
public void secureActuator() throws Exception {
public void secureActuator() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/actuator/env",
Map.class);

View File

@@ -49,14 +49,14 @@ public class SampleActuatorUiApplicationPortTests {
private int managementPort = 9011;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = new TestRestTemplate()
.getForEntity("http://localhost:" + this.port, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void testMetrics() throws Exception {
public void testMetrics() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/actuator/metrics",
@@ -65,7 +65,7 @@ public class SampleActuatorUiApplicationPortTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = new TestRestTemplate()
.withBasicAuth("user", getPassword()).getForEntity(
"http://localhost:" + this.managementPort + "/actuator/health",

View File

@@ -49,7 +49,7 @@ public class SampleActuatorUiApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate
@@ -60,7 +60,7 @@ public class SampleActuatorUiApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -68,7 +68,7 @@ public class SampleActuatorUiApplicationTests {
}
@Test
public void testMetrics() throws Exception {
public void testMetrics() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/actuator/metrics",
Map.class);
@@ -76,7 +76,7 @@ public class SampleActuatorUiApplicationTests {
}
@Test
public void testError() throws Exception {
public void testError() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate

View File

@@ -46,7 +46,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testCustomErrorPath() throws Exception {
public void testCustomErrorPath() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/oops", Map.class);
@@ -58,7 +58,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
}
@Test
public void testCustomContextPath() throws Exception {
public void testCustomContextPath() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/admin/health", String.class);

View File

@@ -50,7 +50,7 @@ public class ManagementAddressActuatorApplicationTests {
private int managementPort = 9011;
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate()
.getForEntity("http://localhost:" + this.port, Map.class);
@@ -58,7 +58,7 @@ public class ManagementAddressActuatorApplicationTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = new TestRestTemplate()
.withBasicAuth("user", getPassword()).getForEntity("http://localhost:"
+ this.managementPort + "/admin/actuator/health", String.class);

View File

@@ -45,7 +45,7 @@ public class ManagementPathSampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/admin/health", String.class);
@@ -54,7 +54,7 @@ public class ManagementPathSampleActuatorApplicationTests {
}
@Test
public void testHomeIsSecure() throws Exception {
public void testHomeIsSecure() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);

View File

@@ -49,7 +49,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
private int managementPort = 9011;
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
.getForEntity("http://localhost:" + this.port, Map.class);
@@ -69,7 +69,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = new TestRestTemplate()
.withBasicAuth("user", getPassword())
.getForEntity("http://localhost:" + this.managementPort + "/admin/health",
@@ -79,7 +79,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testMissing() throws Exception {
public void testMissing() {
ResponseEntity<String> entity = new TestRestTemplate("user", getPassword())
.getForEntity(
"http://localhost:" + this.managementPort + "/admin/missing",
@@ -89,7 +89,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testErrorPage() throws Exception {
public void testErrorPage() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
.getForEntity("http://localhost:" + this.port + "/error", Map.class);
@@ -100,7 +100,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
}
@Test
public void testManagementErrorPage() throws Exception {
public void testManagementErrorPage() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
.getForEntity("http://localhost:" + this.managementPort + "/error",

View File

@@ -49,7 +49,7 @@ public class ManagementPortSampleActuatorApplicationTests {
private int managementPort = 9011;
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
.getForEntity("http://localhost:" + this.port, Map.class);
@@ -70,7 +70,7 @@ public class ManagementPortSampleActuatorApplicationTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = new TestRestTemplate()
.withBasicAuth("user", getPassword()).getForEntity(
"http://localhost:" + this.managementPort + "/actuator/health",
@@ -80,7 +80,7 @@ public class ManagementPortSampleActuatorApplicationTests {
}
@Test
public void testErrorPage() throws Exception {
public void testErrorPage() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
.getForEntity("http://localhost:" + this.managementPort + "/error",

View File

@@ -45,7 +45,7 @@ public class NoManagementSampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/", Map.class);

View File

@@ -52,7 +52,7 @@ public class SampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHomeIsSecure() throws Exception {
public void testHomeIsSecure() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
@@ -63,7 +63,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testMetricsIsSecure() throws Exception {
public void testMetricsIsSecure() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/metrics",
Map.class);
@@ -77,7 +77,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/", Map.class);
@@ -103,7 +103,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testEnv() throws Exception {
public void testEnv() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
@@ -115,7 +115,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/actuator/health", String.class);
@@ -125,7 +125,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testInfo() throws Exception {
public void testInfo() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/actuator/info", String.class);
@@ -140,7 +140,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testErrorPage() throws Exception {
public void testErrorPage() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/foo", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
@@ -149,7 +149,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testHtmlErrorPage() throws Exception {
public void testHtmlErrorPage() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<?> request = new HttpEntity<Void>(headers);
@@ -164,7 +164,7 @@ public class SampleActuatorApplicationTests {
@Test
@SuppressWarnings("unchecked")
public void testTrace() throws Exception {
public void testTrace() {
this.restTemplate.getForEntity("/health", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
@@ -181,7 +181,7 @@ public class SampleActuatorApplicationTests {
@Test
@SuppressWarnings("unchecked")
public void traceWithParameterMap() throws Exception {
public void traceWithParameterMap() {
this.restTemplate.withBasicAuth("user", getPassword())
.getForEntity("/actuator/health?param1=value1", String.class);
@SuppressWarnings("rawtypes")
@@ -198,7 +198,7 @@ public class SampleActuatorApplicationTests {
}
@Test
public void testErrorPageDirectAccess() throws Exception {
public void testErrorPageDirectAccess() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/error", Map.class);
@@ -211,7 +211,7 @@ public class SampleActuatorApplicationTests {
@Test
@SuppressWarnings("unchecked")
public void testBeans() throws Exception {
public void testBeans() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
@@ -224,7 +224,7 @@ public class SampleActuatorApplicationTests {
@SuppressWarnings("unchecked")
@Test
public void testConfigProps() throws Exception {
public void testConfigProps() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())

View File

@@ -45,7 +45,7 @@ public class ServletPathSampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testErrorPath() throws Exception {
public void testErrorPath() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
@@ -58,7 +58,7 @@ public class ServletPathSampleActuatorApplicationTests {
}
@Test
public void testHealth() throws Exception {
public void testHealth() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/spring/actuator/health", String.class);
@@ -67,7 +67,7 @@ public class ServletPathSampleActuatorApplicationTests {
}
@Test
public void testHomeIsSecure() throws Exception {
public void testHomeIsSecure() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/spring/",
Map.class);

View File

@@ -45,7 +45,7 @@ public class ShutdownSampleActuatorApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/", Map.class);
@@ -57,7 +57,7 @@ public class ShutdownSampleActuatorApplicationTests {
@Test
@DirtiesContext
public void testShutdown() throws Exception {
public void testShutdown() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())

View File

@@ -54,7 +54,7 @@ public class SampleAtmosphereApplicationTests {
private int port = 1234;
@Test
public void chatEndpoint() throws Exception {
public void chatEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port

View File

@@ -30,7 +30,7 @@ public class SampleBatchApplicationTests {
public OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
assertThat(SpringApplication
.exit(SpringApplication.run(SampleBatchApplication.class))).isEqualTo(0);
String output = this.outputCapture.toString();

View File

@@ -53,7 +53,7 @@ public class SampleCassandraApplicationTests {
public static SkipOnWindows skipOnWindows = new SkipOnWindows();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
String output = SampleCassandraApplicationTests.outputCapture.toString();
assertThat(output).contains("firstName='Alice', lastName='Smith'");
}

View File

@@ -32,7 +32,7 @@ public class SampleCouchbaseApplicationTests {
public OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
try {
new SpringApplicationBuilder(SampleCouchbaseApplication.class)
.run("--server.port=0");

View File

@@ -45,7 +45,7 @@ public class SampleElasticsearchApplicationTests {
public static SkipOnWindows skipOnWindows = new SkipOnWindows();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
try {
new SpringApplicationBuilder(SampleElasticsearchApplication.class).run();
}

View File

@@ -39,7 +39,7 @@ public class SampleLdapApplicationTests {
public static OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
String output = outputCapture.toString();
assertThat(output).contains("cn=Alice Smith");
}

View File

@@ -40,7 +40,7 @@ public class SampleMongoApplicationTests {
public static OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
String output = SampleMongoApplicationTests.outputCapture.toString();
assertThat(output).contains("firstName='Alice', lastName='Smith'");
}

View File

@@ -35,7 +35,7 @@ public class SampleNeo4jApplicationTests {
public OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
try {
SampleNeo4jApplication.main(new String[0]);
}

View File

@@ -35,7 +35,7 @@ public class SampleRedisApplicationTests {
public OutputCapture outputCapture = new OutputCapture();
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
try {
SampleRedisApplication.main(new String[0]);
}

View File

@@ -43,7 +43,7 @@ public class SampleDevToolsApplicationIntegrationTests {
private TestRestTemplate restTemplate;
@Test
public void testStaticResource() throws Exception {
public void testStaticResource() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/application.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -51,7 +51,7 @@ public class SampleDevToolsApplicationIntegrationTests {
}
@Test
public void testPublicResource() throws Exception {
public void testPublicResource() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/public.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -59,7 +59,7 @@ public class SampleDevToolsApplicationIntegrationTests {
}
@Test
public void testClassResource() throws Exception {
public void testClassResource() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/application.properties", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);

View File

@@ -34,7 +34,7 @@ public class SampleFlywayApplicationTests {
private JdbcTemplate template;
@Test
public void testDefaultSettings() throws Exception {
public void testDefaultSettings() {
assertThat(this.template.queryForObject("SELECT COUNT(*) from PERSON",
Integer.class)).isEqualTo(1);
}

View File

@@ -41,7 +41,7 @@ public class SampleHateoasApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void hasHalLinks() throws Exception {
public void hasHalLinks() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/customers/1",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -51,7 +51,7 @@ public class SampleHateoasApplicationTests {
}
@Test
public void producesJsonWhenXmlIsPreferred() throws Exception {
public void producesJsonWhenXmlIsPreferred() {
HttpHeaders headers = new HttpHeaders();
headers.set(HttpHeaders.ACCEPT, "application/xml;q=0.9,application/json;q=0.8");
HttpEntity<?> request = new HttpEntity<>(headers);

View File

@@ -56,7 +56,7 @@ public class SampleIntegrationApplicationTests {
deleteIfExists(new File("target/output"));
}
private void deleteIfExists(File directory) throws InterruptedException {
private void deleteIfExists(File directory) {
if (directory.exists()) {
assertThat(FileSystemUtils.deleteRecursively(directory)).isTrue();
}

View File

@@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testJspWithEl() throws Exception {
public void testJspWithEl() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("/resources/text.txt");

View File

@@ -51,7 +51,7 @@ public class SampleJettySslApplicationTests {
}
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");

View File

@@ -51,7 +51,7 @@ public class SampleJettyApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");

View File

@@ -34,7 +34,7 @@ public class SampleJooqApplicationTests {
public OutputCapture out = new OutputCapture();
@Test
public void outputResults() throws Exception {
public void outputResults() {
SampleJooqApplication.main(NO_ARGS);
assertThat(this.out.toString()).contains("jOOQ Fetch 1 Greg Turnquest");
assertThat(this.out.toString()).contains("jOOQ Fetch 2 Craig Walls");

View File

@@ -48,7 +48,7 @@ public class SampleBitronixApplicationTests {
}
@Test
public void testExposesXaAndNonXa() throws Exception {
public void testExposesXaAndNonXa() {
ApplicationContext context = SpringApplication
.run(SampleBitronixApplication.class);
Object jmsConnectionFactory = context.getBean("jmsConnectionFactory");

View File

@@ -43,7 +43,7 @@ public class SampleOAuth2ClientApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void everythingShouldRedirectToLogin() throws Exception {
public void everythingShouldRedirectToLogin() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
assertThat(entity.getHeaders().getLocation())
@@ -51,7 +51,7 @@ public class SampleOAuth2ClientApplicationTests {
}
@Test
public void loginShouldHaveBothOAuthClientsToChooseFrom() throws Exception {
public void loginShouldHaveBothOAuthClientsToChooseFrom() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/login",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -44,7 +44,7 @@ public class SampleIntegrationParentApplicationTests {
private static ConfigurableApplicationContext context;
@BeforeClass
public static void start() throws Exception {
public static void start() {
context = SpringApplication.run(SampleParentContextApplication.class);
}

View File

@@ -57,24 +57,24 @@ public class SampleSecureApplicationTests {
}
@Test(expected = AuthenticationException.class)
public void secure() throws Exception {
public void secure() {
assertThat("Hello Security").isEqualTo(this.service.secure());
}
@Test
public void authenticated() throws Exception {
public void authenticated() {
SecurityContextHolder.getContext().setAuthentication(this.authentication);
assertThat("Hello Security").isEqualTo(this.service.secure());
}
@Test
public void preauth() throws Exception {
public void preauth() {
SecurityContextHolder.getContext().setAuthentication(this.authentication);
assertThat("Hello World").isEqualTo(this.service.authorized());
}
@Test(expected = AccessDeniedException.class)
public void denied() throws Exception {
public void denied() {
SecurityContextHolder.getContext().setAuthentication(this.authentication);
assertThat("Goodbye World").isEqualTo(this.service.denied());
}

View File

@@ -48,7 +48,7 @@ public class SampleServletApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHomeIsSecure() throws Exception {
public void testHomeIsSecure() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET,
@@ -57,7 +57,7 @@ public class SampleServletApplicationTests {
}
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -39,7 +39,7 @@ public class SpringTestSampleSimpleApplicationTests {
ApplicationContext ctx;
@Test
public void testContextLoads() throws Exception {
public void testContextLoads() {
assertThat(this.ctx).isNotNull();
assertThat(this.ctx.containsBean("helloWorldService")).isTrue();
assertThat(this.ctx.containsBean("sampleSimpleApplication")).isTrue();

View File

@@ -47,28 +47,28 @@ public class UserEntityTests {
private TestEntityManager entityManager;
@Test
public void createWhenUsernameIsNullShouldThrowException() throws Exception {
public void createWhenUsernameIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Username must not be empty");
new User(null, VIN);
}
@Test
public void createWhenUsernameIsEmptyShouldThrowException() throws Exception {
public void createWhenUsernameIsEmptyShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Username must not be empty");
new User("", VIN);
}
@Test
public void createWhenVinIsNullShouldThrowException() throws Exception {
public void createWhenVinIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("VIN must not be null");
new User("sboot", null);
}
@Test
public void saveShouldPersistData() throws Exception {
public void saveShouldPersistData() {
User user = this.entityManager.persistFlushFind(new User("sboot", VIN));
assertThat(user.getUsername()).isEqualTo("sboot");
assertThat(user.getVin()).isEqualTo(VIN);

View File

@@ -45,7 +45,7 @@ public class UserRepositoryTests {
private UserRepository repository;
@Test
public void findByUsernameShouldReturnUser() throws Exception {
public void findByUsernameShouldReturnUser() {
this.entityManager.persist(new User("sboot", VIN));
User user = this.repository.findByUsername("sboot");
assertThat(user.getUsername()).isEqualTo("sboot");
@@ -53,7 +53,7 @@ public class UserRepositoryTests {
}
@Test
public void findByUsernameWhenNoUserShouldReturnNull() throws Exception {
public void findByUsernameWhenNoUserShouldReturnNull() {
this.entityManager.persist(new User("sboot", VIN));
User user = this.repository.findByUsername("mmouse");
assertThat(user).isNull();

View File

@@ -38,34 +38,34 @@ public class VehicleIdentificationNumberTests {
public ExpectedException thrown = ExpectedException.none();
@Test
public void createWhenVinIsNullShouldThrowException() throws Exception {
public void createWhenVinIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("VIN must not be null");
new VehicleIdentificationNumber(null);
}
@Test
public void createWhenVinIsMoreThan17CharsShouldThrowException() throws Exception {
public void createWhenVinIsMoreThan17CharsShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("VIN must be exactly 17 characters");
new VehicleIdentificationNumber("012345678901234567");
}
@Test
public void createWhenVinIsLessThan17CharsShouldThrowException() throws Exception {
public void createWhenVinIsLessThan17CharsShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("VIN must be exactly 17 characters");
new VehicleIdentificationNumber("0123456789012345");
}
@Test
public void toStringShouldReturnVin() throws Exception {
public void toStringShouldReturnVin() {
VehicleIdentificationNumber vin = new VehicleIdentificationNumber(SAMPLE_VIN);
assertThat(vin.toString()).isEqualTo(SAMPLE_VIN);
}
@Test
public void equalsAndHashCodeShouldBeBasedOnVin() throws Exception {
public void equalsAndHashCodeShouldBeBasedOnVin() {
VehicleIdentificationNumber vin1 = new VehicleIdentificationNumber(SAMPLE_VIN);
VehicleIdentificationNumber vin2 = new VehicleIdentificationNumber(SAMPLE_VIN);
VehicleIdentificationNumber vin3 = new VehicleIdentificationNumber(

View File

@@ -58,15 +58,14 @@ public class RemoteVehicleDetailsServiceTests {
private MockRestServiceServer server;
@Test
public void getVehicleDetailsWhenVinIsNullShouldThrowException() throws Exception {
public void getVehicleDetailsWhenVinIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("VIN must not be null");
this.service.getVehicleDetails(null);
}
@Test
public void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails()
throws Exception {
public void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() {
this.server.expect(requestTo("/vehicle/" + VIN + "/details"))
.andRespond(withSuccess(getClassPathResource("vehicledetails.json"),
MediaType.APPLICATION_JSON));
@@ -77,8 +76,7 @@ public class RemoteVehicleDetailsServiceTests {
}
@Test
public void getVehicleDetailsWhenResultIsNotFoundShouldThrowException()
throws Exception {
public void getVehicleDetailsWhenResultIsNotFoundShouldThrowException() {
this.server.expect(requestTo("/vehicle/" + VIN + "/details"))
.andRespond(withStatus(HttpStatus.NOT_FOUND));
this.thrown.expect(VehicleIdentificationNumberNotFoundException.class);
@@ -86,8 +84,7 @@ public class RemoteVehicleDetailsServiceTests {
}
@Test
public void getVehicleDetailsWhenResultIServerErrorShouldThrowException()
throws Exception {
public void getVehicleDetailsWhenResultIServerErrorShouldThrowException() {
this.server.expect(requestTo("/vehicle/" + VIN + "/details"))
.andRespond(withServerError());
this.thrown.expect(HttpServerErrorException.class);

View File

@@ -66,7 +66,7 @@ public class UserVehicleControllerApplicationTests {
}
@Test
public void welcomeCommandLineRunnerShouldBeAvailable() throws Exception {
public void welcomeCommandLineRunnerShouldBeAvailable() {
// Since we're a @SpringBootTest all beans should be available.
assertThat(this.applicationContext.getBean(WelcomeCommandLineRunner.class))
.isNotNull();

View File

@@ -47,7 +47,7 @@ public class UserVehicleControllerSeleniumTests {
private UserVehicleService userVehicleService;
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() {
given(this.userVehicleService.getVehicleDetails("sboot"))
.willReturn(new VehicleDetails("Honda", "Civic"));
this.webDriver.get("/sboot/vehicle.html");

View File

@@ -101,7 +101,7 @@ public class UserVehicleControllerTests {
}
@Test(expected = NoSuchBeanDefinitionException.class)
public void welcomeCommandLineRunnerShouldBeAvailable() throws Exception {
public void welcomeCommandLineRunnerShouldBeAvailable() {
// Since we're a @WebMvcTest WelcomeCommandLineRunner should not be available.
assertThat(this.applicationContext.getBean(WelcomeCommandLineRunner.class));
}

View File

@@ -61,23 +61,21 @@ public class UserVehicleServiceTests {
}
@Test
public void getVehicleDetailsWhenUsernameIsNullShouldThrowException()
throws Exception {
public void getVehicleDetailsWhenUsernameIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Username must not be null");
this.service.getVehicleDetails(null);
}
@Test
public void getVehicleDetailsWhenUsernameNotFoundShouldThrowException()
throws Exception {
public void getVehicleDetailsWhenUsernameNotFoundShouldThrowException() {
given(this.userRepository.findByUsername(anyString())).willReturn(null);
this.thrown.expect(UserNameNotFoundException.class);
this.service.getVehicleDetails("sboot");
}
@Test
public void getVehicleDetailsShouldReturnMakeAndModel() throws Exception {
public void getVehicleDetailsShouldReturnMakeAndModel() {
given(this.userRepository.findByUsername(anyString()))
.willReturn(new User("sboot", VIN));
VehicleDetails details = new VehicleDetails("Honda", "Civic");

View File

@@ -40,7 +40,7 @@ public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTes
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");

View File

@@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testJspWithEl() throws Exception {
public void testJspWithEl() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("/resources/text.txt");

View File

@@ -68,7 +68,7 @@ public class SampleTomcatTwoConnectorsApplicationTests {
}
@Test
public void testHello() throws Exception {
public void testHello() {
assertThat(this.ports.getHttpsPort()).isEqualTo(this.port);
assertThat(this.ports.getHttpPort()).isNotEqualTo(this.port);
ResponseEntity<String> entity = this.restTemplate.getForEntity(

View File

@@ -46,7 +46,7 @@ public class SampleTomcatSslApplicationTests {
}
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello, world");

View File

@@ -61,14 +61,14 @@ public class NonAutoConfigurationSampleTomcatApplicationTests {
HelloWorldService.class })
public static class NonAutoConfigurationSampleTomcatApplication {
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
SpringApplication.run(SampleTomcatApplication.class, args);
}
}
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");

View File

@@ -59,7 +59,7 @@ public class SampleTomcatApplicationTests {
private ApplicationContext applicationContext;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
@@ -81,7 +81,7 @@ public class SampleTomcatApplicationTests {
}
@Test
public void testTimeout() throws Exception {
public void testTimeout() {
ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext;
TomcatWebServer embeddedServletContainer = (TomcatWebServer) context
.getWebServer();

View File

@@ -42,7 +42,7 @@ public class SampleTraditionalApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHomeJsp() throws Exception {
public void testHomeJsp() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
String body = entity.getBody();
@@ -50,7 +50,7 @@ public class SampleTraditionalApplicationTests {
}
@Test
public void testStaticPage() throws Exception {
public void testStaticPage() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/index.html",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -51,12 +51,12 @@ public class SampleUndertowApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
assertOkResponse("/", "Hello World");
}
@Test
public void testAsync() throws Exception {
public void testAsync() {
assertOkResponse("/async", "async: Hello World");
}

View File

@@ -49,7 +49,7 @@ public class SampleWebFreeMarkerApplicationTests {
private TestRestTemplate testRestTemplate;
@Test
public void testFreeMarkerTemplate() throws Exception {
public void testFreeMarkerTemplate() {
ResponseEntity<String> entity = this.testRestTemplate.getForEntity("/",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@@ -57,7 +57,7 @@ public class SampleWebFreeMarkerApplicationTests {
}
@Test
public void testFreeMarkerErrorTemplate() throws Exception {
public void testFreeMarkerErrorTemplate() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<String> requestEntity = new HttpEntity<>(headers);

View File

@@ -50,7 +50,7 @@ public class SampleGroovyTemplateApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("<title>Messages");
@@ -58,7 +58,7 @@ public class SampleGroovyTemplateApplicationTests {
}
@Test
public void testCreate() throws Exception {
public void testCreate() {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.set("text", "FOO text");
map.set("summary", "FOO");
@@ -67,7 +67,7 @@ public class SampleGroovyTemplateApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -42,7 +42,7 @@ public class SampleWebJspApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testJspWithEl() throws Exception {
public void testJspWithEl() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("/resources/text.txt");

View File

@@ -57,7 +57,7 @@ public class SampleMethodSecurityApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET,
@@ -67,7 +67,7 @@ public class SampleMethodSecurityApplicationTests {
}
@Test
public void testLogin() throws Exception {
public void testLogin() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
@@ -82,7 +82,7 @@ public class SampleMethodSecurityApplicationTests {
}
@Test
public void testDenied() throws Exception {
public void testDenied() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
@@ -102,7 +102,7 @@ public class SampleMethodSecurityApplicationTests {
}
@Test
public void testManagementProtected() throws Exception {
public void testManagementProtected() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
ResponseEntity<String> entity = this.restTemplate.exchange("/actuator/beans",
@@ -111,7 +111,7 @@ public class SampleMethodSecurityApplicationTests {
}
@Test
public void testManagementAuthorizedAccess() throws Exception {
public void testManagementAuthorizedAccess() {
BasicAuthorizationInterceptor basicAuthInterceptor = new BasicAuthorizationInterceptor(
"admin", "admin");
this.restTemplate.getRestTemplate().getInterceptors().add(basicAuthInterceptor);

View File

@@ -49,14 +49,14 @@ public class SampleWebMustacheApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testMustacheTemplate() throws Exception {
public void testMustacheTemplate() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("Hello, Andy");
}
@Test
public void testMustacheErrorTemplate() throws Exception {
public void testMustacheErrorTemplate() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
@@ -68,7 +68,7 @@ public class SampleWebMustacheApplicationTests {
}
@Test
public void test503HtmlResource() throws Exception {
public void test503HtmlResource() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
@@ -79,7 +79,7 @@ public class SampleWebMustacheApplicationTests {
}
@Test
public void test5xxHtmlResource() throws Exception {
public void test5xxHtmlResource() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
@@ -90,7 +90,7 @@ public class SampleWebMustacheApplicationTests {
}
@Test
public void test507Template() throws Exception {
public void test507Template() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
HttpEntity<String> requestEntity = new HttpEntity<>(headers);

View File

@@ -56,7 +56,7 @@ public class SampleWebSecureCustomApplicationTests {
private int port;
@Test
public void testHome() throws Exception {
public void testHome() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET,
@@ -67,7 +67,7 @@ public class SampleWebSecureCustomApplicationTests {
}
@Test
public void testLoginPage() throws Exception {
public void testLoginPage() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
@@ -77,7 +77,7 @@ public class SampleWebSecureCustomApplicationTests {
}
@Test
public void testLogin() throws Exception {
public void testLogin() {
HttpHeaders headers = getHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
@@ -107,7 +107,7 @@ public class SampleWebSecureCustomApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -56,7 +56,7 @@ public class SampleWebSecureJdbcApplicationTests {
private int port;
@Test
public void testHome() throws Exception {
public void testHome() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET,
@@ -67,7 +67,7 @@ public class SampleWebSecureJdbcApplicationTests {
}
@Test
public void testLoginPage() throws Exception {
public void testLoginPage() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
@@ -77,7 +77,7 @@ public class SampleWebSecureJdbcApplicationTests {
}
@Test
public void testLogin() throws Exception {
public void testLogin() {
HttpHeaders headers = getHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
@@ -107,7 +107,7 @@ public class SampleWebSecureJdbcApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -56,7 +56,7 @@ public class SampleSecureApplicationTests {
private int port;
@Test
public void testHome() throws Exception {
public void testHome() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/", HttpMethod.GET,
@@ -67,7 +67,7 @@ public class SampleSecureApplicationTests {
}
@Test
public void testLoginPage() throws Exception {
public void testLoginPage() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
@@ -77,7 +77,7 @@ public class SampleSecureApplicationTests {
}
@Test
public void testLogin() throws Exception {
public void testLogin() {
HttpHeaders headers = getHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
@@ -107,7 +107,7 @@ public class SampleSecureApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -43,14 +43,14 @@ public class SampleWebStaticApplicationTests {
private TestRestTemplate restTemplate;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("<title>Static");
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate.getForEntity(
"/webjars/bootstrap/3.0.3/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -50,7 +50,7 @@ public class SampleWebUiApplicationTests {
private int port;
@Test
public void testHome() throws Exception {
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("<title>Messages");
@@ -58,7 +58,7 @@ public class SampleWebUiApplicationTests {
}
@Test
public void testCreate() throws Exception {
public void testCreate() {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.set("text", "FOO text");
map.set("summary", "FOO");
@@ -67,7 +67,7 @@ public class SampleWebUiApplicationTests {
}
@Test
public void testCss() throws Exception {
public void testCss() {
ResponseEntity<String> entity = this.restTemplate.getForEntity(
"http://localhost:" + this.port + "/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

View File

@@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests {
private int port = 1234;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties(

View File

@@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests {
private int port;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port

View File

@@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests {
private int port = 1234;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties(

View File

@@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests {
private int port;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port

View File

@@ -54,7 +54,7 @@ public class SampleWebSocketsApplicationTests {
private int port = 1234;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -70,7 +70,7 @@ public class SampleWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties(

View File

@@ -60,7 +60,7 @@ public class CustomContainerWebSocketsApplicationTests {
private int port;
@Test
public void echoEndpoint() throws Exception {
public void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -76,7 +76,7 @@ public class CustomContainerWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() throws Exception {
public void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port