From 54d136518ecc6a26a2c755f769c74ed248a1a532 Mon Sep 17 00:00:00 2001 From: eugenp Date: Thu, 18 May 2017 10:22:09 +0300 Subject: [PATCH] minor cleanup --- guest/spring-boot-app/pom.xml | 113 +++++++++--------- .../main/java/com/stackify/Application.java | 2 +- .../stackify/config/PersistenceConfig.java | 5 +- .../controller/EmployeeController.java | 4 +- .../stackify/test/EmployeeControllerTest.java | 14 +-- 5 files changed, 62 insertions(+), 76 deletions(-) diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index e92e5dbbc9..88b8c229e3 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -1,64 +1,61 @@ - - 4.0.0 - spring-boot-app - spring-boot-app - 0.0.1-SNAPSHOT - war + + 4.0.0 + spring-boot-app + spring-boot-app + 0.0.1-SNAPSHOT + war - - org.springframework.boot - spring-boot-starter-parent - 1.5.3.RELEASE - - + + org.springframework.boot + spring-boot-starter-parent + 1.5.3.RELEASE + - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-test - - + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-test + + - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - maven-war-plugin - 3.0.0 - - WebContent - - - - + + + + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + maven-war-plugin + 3.1.0 + + WebContent + + + + - - 8.0.43 - + + 8.0.43 + \ No newline at end of file diff --git a/guest/spring-boot-app/src/main/java/com/stackify/Application.java b/guest/spring-boot-app/src/main/java/com/stackify/Application.java index 81251e9765..b950ea2c1c 100644 --- a/guest/spring-boot-app/src/main/java/com/stackify/Application.java +++ b/guest/spring-boot-app/src/main/java/com/stackify/Application.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { - public static void main(String[] args){ + public static void main(String[] args) { SpringApplication.run(Application.class, args); } } diff --git a/guest/spring-boot-app/src/main/java/com/stackify/config/PersistenceConfig.java b/guest/spring-boot-app/src/main/java/com/stackify/config/PersistenceConfig.java index 9cc003e167..dfbd964228 100644 --- a/guest/spring-boot-app/src/main/java/com/stackify/config/PersistenceConfig.java +++ b/guest/spring-boot-app/src/main/java/com/stackify/config/PersistenceConfig.java @@ -14,10 +14,7 @@ public class PersistenceConfig { @Bean public DataSource dataSource() { EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); - EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2) - .addScript("mySchema.sql") - .addScript("myData.sql") - .build(); + EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("mySchema.sql").addScript("myData.sql").build(); return db; } diff --git a/guest/spring-boot-app/src/main/java/com/stackify/controller/EmployeeController.java b/guest/spring-boot-app/src/main/java/com/stackify/controller/EmployeeController.java index 17501921bf..44ad61fcfe 100644 --- a/guest/spring-boot-app/src/main/java/com/stackify/controller/EmployeeController.java +++ b/guest/spring-boot-app/src/main/java/com/stackify/controller/EmployeeController.java @@ -16,8 +16,8 @@ import com.stackify.repository.EmployeeRepository; public class EmployeeController { private EmployeeRepository employeeRepository; - - public EmployeeController(EmployeeRepository employeeRepository){ + + public EmployeeController(EmployeeRepository employeeRepository) { this.employeeRepository = employeeRepository; } diff --git a/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java b/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java index 8ca34b6224..2711a77ebd 100644 --- a/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java +++ b/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java @@ -32,23 +32,15 @@ public class EmployeeControllerTest { @Before public void setup() throws Exception { - this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) - .build(); + this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); } @Test public void whenCreateGetEmployee_thenOk() throws Exception { String employeeJson = "{\"name\":\"john\"}"; - this.mockMvc.perform(post("/employees").contentType(CONTENT_TYPE) - .content(employeeJson)) - .andExpect(status().isCreated()); + this.mockMvc.perform(post("/employees").contentType(CONTENT_TYPE).content(employeeJson)).andExpect(status().isCreated()); - 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"))); + 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"))); } }