Skip to content

Commit 54d1365

Browse files
author
eugenp
committed
minor cleanup
1 parent 6d4682f commit 54d1365

5 files changed

Lines changed: 62 additions & 76 deletions

File tree

‎guest/spring-boot-app/pom.xml‎

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,61 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<groupId>spring-boot-app</groupId>
5-
<artifactId>spring-boot-app</artifactId>
6-
<version>0.0.1-SNAPSHOT</version>
7-
<packaging>war</packaging>
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+
<groupId>spring-boot-app</groupId>
4+
<artifactId>spring-boot-app</artifactId>
5+
<version>0.0.1-SNAPSHOT</version>
6+
<packaging>war</packaging>
87

9-
<parent>
10-
<groupId>org.springframework.boot</groupId>
11-
<artifactId>spring-boot-starter-parent</artifactId>
12-
<version>1.5.3.RELEASE</version>
13-
<relativePath />
14-
</parent>
8+
<parent>
9+
<groupId>org.springframework.boot</groupId>
10+
<artifactId>spring-boot-starter-parent</artifactId>
11+
<version>1.5.3.RELEASE</version>
12+
</parent>
1513

16-
<dependencies>
17-
<dependency>
18-
<groupId>org.springframework.boot</groupId>
19-
<artifactId>spring-boot-starter-web</artifactId>
20-
</dependency>
21-
<dependency>
22-
<groupId>org.springframework.boot</groupId>
23-
<artifactId>spring-boot-starter-data-jpa</artifactId>
24-
</dependency>
25-
<dependency>
26-
<groupId>com.h2database</groupId>
27-
<artifactId>h2</artifactId>
28-
</dependency>
29-
<dependency>
30-
<groupId>org.springframework.boot</groupId>
31-
<artifactId>spring-boot-starter-actuator</artifactId>
32-
</dependency>
33-
<dependency>
34-
<groupId>org.springframework.boot</groupId>
35-
<artifactId>spring-boot-starter-test</artifactId>
36-
</dependency>
37-
</dependencies>
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.springframework.boot</groupId>
17+
<artifactId>spring-boot-starter-web</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.springframework.boot</groupId>
21+
<artifactId>spring-boot-starter-data-jpa</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>com.h2database</groupId>
25+
<artifactId>h2</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-actuator</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-test</artifactId>
34+
</dependency>
35+
</dependencies>
3836

39-
<build>
40-
<sourceDirectory>src</sourceDirectory>
41-
<plugins>
42-
<plugin>
43-
<artifactId>maven-compiler-plugin</artifactId>
44-
<version>3.5.1</version>
45-
<configuration>
46-
<source>1.8</source>
47-
<target>1.8</target>
48-
</configuration>
49-
</plugin>
50-
<plugin>
51-
<artifactId>maven-war-plugin</artifactId>
52-
<version>3.0.0</version>
53-
<configuration>
54-
<warSourceDirectory>WebContent</warSourceDirectory>
55-
</configuration>
56-
</plugin>
57-
</plugins>
58-
</build>
37+
<build>
38+
<plugins>
39+
<plugin>
40+
<artifactId>maven-compiler-plugin</artifactId>
41+
<version>3.6.1</version>
42+
<configuration>
43+
<source>1.8</source>
44+
<target>1.8</target>
45+
</configuration>
46+
</plugin>
47+
<plugin>
48+
<artifactId>maven-war-plugin</artifactId>
49+
<version>3.1.0</version>
50+
<configuration>
51+
<warSourceDirectory>WebContent</warSourceDirectory>
52+
</configuration>
53+
</plugin>
54+
</plugins>
55+
</build>
5956

60-
<properties>
61-
<tomcat.version>8.0.43</tomcat.version>
62-
</properties>
57+
<properties>
58+
<tomcat.version>8.0.43</tomcat.version>
59+
</properties>
6360

6461
</project>

‎guest/spring-boot-app/src/main/java/com/stackify/Application.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@SpringBootApplication
77
public class Application {
8-
public static void main(String[] args){
8+
public static void main(String[] args) {
99
SpringApplication.run(Application.class, args);
1010
}
1111
}

‎guest/spring-boot-app/src/main/java/com/stackify/config/PersistenceConfig.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ public class PersistenceConfig {
1414
@Bean
1515
public DataSource dataSource() {
1616
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
17-
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2)
18-
.addScript("mySchema.sql")
19-
.addScript("myData.sql")
20-
.build();
17+
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("mySchema.sql").addScript("myData.sql").build();
2118
return db;
2219
}
2320

‎guest/spring-boot-app/src/main/java/com/stackify/controller/EmployeeController.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
public class EmployeeController {
1717

1818
private EmployeeRepository employeeRepository;
19-
20-
public EmployeeController(EmployeeRepository employeeRepository){
19+
20+
public EmployeeController(EmployeeRepository employeeRepository) {
2121
this.employeeRepository = employeeRepository;
2222
}
2323

‎guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,15 @@ public class EmployeeControllerTest {
3232

3333
@Before
3434
public void setup() throws Exception {
35-
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
36-
.build();
35+
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
3736
}
3837

3938
@Test
4039
public void whenCreateGetEmployee_thenOk() throws Exception {
4140
String employeeJson = "{\"name\":\"john\"}";
4241

43-
this.mockMvc.perform(post("/employees").contentType(CONTENT_TYPE)
44-
.content(employeeJson))
45-
.andExpect(status().isCreated());
42+
this.mockMvc.perform(post("/employees").contentType(CONTENT_TYPE).content(employeeJson)).andExpect(status().isCreated());
4643

47-
this.mockMvc.perform(get("/employees"))
48-
.andExpect(status().isOk())
49-
.andExpect(content().contentType(CONTENT_TYPE))
50-
.andExpect(jsonPath("$", hasSize(2)))
51-
.andExpect(jsonPath("$[0].name", is("ana")))
52-
.andExpect(jsonPath("$[1].name", is("john")));
44+
this.mockMvc.perform(get("/employees")).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$", hasSize(2))).andExpect(jsonPath("$[0].name", is("ana"))).andExpect(jsonPath("$[1].name", is("john")));
5345
}
5446
}

0 commit comments

Comments
 (0)