File tree Expand file tree Collapse file tree
spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration
spring-boot-bootstrap/src/test/java/org/baeldung
spring-boot-client/src/test/java/org/baeldung/boot/client
spring-boot-disable-console-logging
disabling-console-logback
spring-boot/src/test/java
spring-cloud/spring-cloud-vault Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public DataSource dataSource() {
4747 final DriverManagerDataSource dataSource = new DriverManagerDataSource ();
4848
4949 dataSource .setDriverClassName ("com.mysql.cj.jdbc.Driver" );
50- dataSource .setUrl ("jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true" );
50+ dataSource .setUrl ("jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true&&serverTimezone=UTC " );
5151 dataSource .setUsername ("mysqluser" );
5252 dataSource .setPassword ("mysqlpass" );
5353
Original file line number Diff line number Diff line change 44import static org .apache .commons .lang3 .RandomStringUtils .randomNumeric ;
55import static org .junit .Assert .assertEquals ;
66import static org .junit .Assert .assertTrue ;
7- import io .restassured .RestAssured ;
8- import io .restassured .response .Response ;
97
108import java .util .List ;
119
1210import org .baeldung .persistence .model .Book ;
1311import org .junit .Test ;
14- import org .junit .runner .RunWith ;
15- import org .springframework .boot .test .context .SpringBootTest ;
16- import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
1712import org .springframework .http .HttpStatus ;
1813import org .springframework .http .MediaType ;
19- import org .springframework .test .context .junit4 .SpringRunner ;
2014
21- @ RunWith (SpringRunner .class )
22- @ SpringBootTest (classes = Application .class , webEnvironment = WebEnvironment .DEFINED_PORT )
15+ import io .restassured .RestAssured ;
16+ import io .restassured .response .Response ;
17+
2318public class SpringBootBootstrapIntegrationTest {
2419
25- private static final String API_ROOT = "http://localhost:8081 /api/books" ;
20+ private static final String API_ROOT = "http://localhost:8080 /api/books" ;
2621
2722 @ Test
2823 public void whenGetAllBooks_thenOK () {
Original file line number Diff line number Diff line change 1010import org .junit .runner .RunWith ;
1111import org .springframework .beans .factory .annotation .Autowired ;
1212import org .springframework .boot .test .autoconfigure .web .client .RestClientTest ;
13- import org .springframework .boot .test .context .SpringBootTest ;
1413import org .springframework .http .MediaType ;
1514import org .springframework .test .context .junit4 .SpringRunner ;
1615import org .springframework .test .web .client .MockRestServiceServer ;
1716
1817import com .fasterxml .jackson .databind .ObjectMapper ;
1918
2019@ RunWith (SpringRunner .class )
21- @ SpringBootTest (classes = Application .class )
22- @ RestClientTest (DetailsServiceClient .class )
20+ @ RestClientTest ({ DetailsServiceClient .class , Application .class })
2321public class DetailsServiceClientIntegrationTest {
2422
2523 @ Autowired
@@ -34,7 +32,8 @@ public class DetailsServiceClientIntegrationTest {
3432 @ Before
3533 public void setUp () throws Exception {
3634 String detailsString = objectMapper .writeValueAsString (new Details ("John Smith" , "john" ));
37- this .server .expect (requestTo ("/john/details" )).andRespond (withSuccess (detailsString , MediaType .APPLICATION_JSON ));
35+ this .server .expect (requestTo ("/john/details" ))
36+ .andRespond (withSuccess (detailsString , MediaType .APPLICATION_JSON ));
3837 }
3938
4039 @ Test
Original file line number Diff line number Diff line change 1+ baeldung.log
Original file line number Diff line number Diff line change 88 <parent >
99 <groupId >org.springframework.boot</groupId >
1010 <artifactId >spring-boot-starter-parent</artifactId >
11- <version >2.0.5 .RELEASE</version >
11+ <version >2.1.1 .RELEASE</version >
1212 </parent >
1313
1414 <dependencies >
Original file line number Diff line number Diff line change 1+ all.log
Original file line number Diff line number Diff line change 88 <parent >
99 <groupId >org.springframework.boot</groupId >
1010 <artifactId >spring-boot-starter-parent</artifactId >
11- <version >2.0.5 .RELEASE</version >
11+ <version >2.1.1 .RELEASE</version >
1212 </parent >
1313
1414 <dependencies >
Original file line number Diff line number Diff line change 1+ disabled-console.log
Original file line number Diff line number Diff line change 1- <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
2- <modelVersion >4.0.0</modelVersion >
3- <artifactId >disabling-console-logback</artifactId >
4- <name >disabling-console-logback</name >
1+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
2+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <artifactId >disabling-console-logback</artifactId >
6+ <name >disabling-console-logback</name >
7+
8+ <parent >
9+ <artifactId >spring-boot-disable-console-logging</artifactId >
10+ <groupId >com.baeldung</groupId >
11+ <version >0.0.1-SNAPSHOT</version >
12+ <relativePath >../</relativePath >
13+ </parent >
14+
15+ <dependencies >
16+ <dependency >
17+ <groupId >org.springframework.boot</groupId >
18+ <artifactId >spring-boot-starter-web</artifactId >
19+ </dependency >
20+ </dependencies >
521
6- <parent >
7- <groupId >com.baeldung</groupId >
8- <artifactId >spring-boot-disable-console-logging</artifactId >
9- <version >0.0.1-SNAPSHOT</version >
10- </parent >
11-
12- <dependencies >
13- <dependency >
14- <groupId >org.springframework.boot</groupId >
15- <artifactId >spring-boot-starter-web</artifactId >
16- </dependency >
17- </dependencies >
18-
1922</project >
Original file line number Diff line number Diff line change 11package com .baeldung .intro ;
22
3+ import static org .hamcrest .Matchers .equalTo ;
4+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .content ;
5+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
6+
37import org .junit .Test ;
48import org .junit .runner .RunWith ;
59import org .springframework .beans .factory .annotation .Autowired ;
610import org .springframework .boot .test .autoconfigure .web .servlet .AutoConfigureMockMvc ;
711import org .springframework .boot .test .context .SpringBootTest ;
812import org .springframework .http .MediaType ;
9- import org .springframework .test .context .TestPropertySource ;
1013import org .springframework .test .context .junit4 .SpringRunner ;
1114import org .springframework .test .web .servlet .MockMvc ;
1215import org .springframework .test .web .servlet .request .MockMvcRequestBuilders ;
1316
14- import static org .hamcrest .Matchers .equalTo ;
15- import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .content ;
16- import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
17-
1817@ RunWith (SpringRunner .class )
1918@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .MOCK )
2019@ AutoConfigureMockMvc
You can’t perform that action at this time.
0 commit comments