From 29adc663756708b5d1640b3f330f43603adfd03e Mon Sep 17 00:00:00 2001 From: harshavs Date: Fri, 2 Aug 2019 02:56:36 -0400 Subject: [PATCH] Fixed formating and removed unused files --- .../com/baeldung/boot/domain/Employee.java | 52 +++++++++---------- .../tests/SpringBootInitialLoadTest.java | 18 +++---- .../SpringBootSqlGroupAnnotationTest.java | 21 ++++---- .../src/test/resources/drop_employees.sql | 1 - .../employees_schema_with_comments.sql | 10 ---- 5 files changed, 44 insertions(+), 58 deletions(-) delete mode 100644 persistence-modules/spring-boot-persistence/src/test/resources/drop_employees.sql delete mode 100644 persistence-modules/spring-boot-persistence/src/test/resources/employees_schema_with_comments.sql diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/domain/Employee.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/domain/Employee.java index c96aca9921..07e69a6f62 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/domain/Employee.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/domain/Employee.java @@ -13,38 +13,38 @@ import javax.persistence.Table; @Table(name = "employees") public class Employee { - @Id - @GeneratedValue - private int id; - private String name; - private String title; + @Id + @GeneratedValue + private int id; + private String name; + private String title; - public Employee() { + public Employee() { - } + } - public Employee(String name, String title) { - this.name = name; - this.title = title; - } + public Employee(String name, String title) { + this.name = name; + this.title = title; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getTitle() { - return title; - } + public String getTitle() { + return title; + } - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } - public int getId() { - return id; - } + public int getId() { + return id; + } } diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootInitialLoadTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootInitialLoadTest.java index 105d18166c..cb5c877431 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootInitialLoadTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootInitialLoadTest.java @@ -19,17 +19,17 @@ import com.baeldung.boot.repository.EmployeeRepository; @Sql({ "/employees_schema.sql", "/import_employees.sql" }) public class SpringBootInitialLoadTest { - @Autowired - private EmployeeRepository employeeRepository; + @Autowired + private EmployeeRepository employeeRepository; - @Test - public void testLoadDataForTestClass() { - assertEquals(employeeRepository.findAll().size(), 3); - } + @Test + public void testLoadDataForTestClass() { + assertEquals(employeeRepository.findAll().size(), 3); + } - @Test - @Sql(scripts = {"/import_senior_employees.sql" } - , config = @SqlConfig(encoding = "utf-8", transactionMode = TransactionMode.ISOLATED)) + @Test + @Sql(scripts = {"/import_senior_employees.sql" } + , config = @SqlConfig(encoding = "utf-8", transactionMode = TransactionMode.ISOLATED)) public void testLoadDataForTestCase() { assertEquals(employeeRepository.findAll().size(), 5); } diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationTest.java index 0f9724489f..3438f57fb8 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationTest.java @@ -2,13 +2,11 @@ package com.baeldung.springbootinitialload.tests; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.context.jdbc.SqlConfig; import org.springframework.test.context.jdbc.SqlConfig.TransactionMode; import org.springframework.test.context.jdbc.SqlGroup; @@ -19,17 +17,16 @@ import com.baeldung.boot.repository.EmployeeRepository; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) -@SqlGroup({ - @Sql(scripts = "/employees_schema_with_comments.sql", config = @SqlConfig(encoding = "utf-8", commentPrefix = "\\", transactionMode = TransactionMode.ISOLATED)), - @Sql("/import_employees.sql"), - @Sql(executionPhase = ExecutionPhase.AFTER_TEST_METHOD, scripts = { "/drop_employees.sql" }) }) +@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)), + @Sql("/import_employees.sql")}) public class SpringBootSqlGroupAnnotationTest { - @Autowired - private EmployeeRepository employeeRepository; + @Autowired + private EmployeeRepository employeeRepository; - @Test - public void testLoadDataForTestCase() { - assertEquals(employeeRepository.findAll().size(), 3); - } + @Test + public void testLoadDataForTestCase() { + assertEquals(employeeRepository.findAll() + .size(), 3); + } } diff --git a/persistence-modules/spring-boot-persistence/src/test/resources/drop_employees.sql b/persistence-modules/spring-boot-persistence/src/test/resources/drop_employees.sql deleted file mode 100644 index eead688647..0000000000 --- a/persistence-modules/spring-boot-persistence/src/test/resources/drop_employees.sql +++ /dev/null @@ -1 +0,0 @@ -drop table if exists EMPLOYEES; \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/test/resources/employees_schema_with_comments.sql b/persistence-modules/spring-boot-persistence/src/test/resources/employees_schema_with_comments.sql deleted file mode 100644 index 25805eba84..0000000000 --- a/persistence-modules/spring-boot-persistence/src/test/resources/employees_schema_with_comments.sql +++ /dev/null @@ -1,10 +0,0 @@ ---Drop the table -drop table EMPLOYEES if exists; - ---Create the table -create table EMPLOYEES( - ID int not null AUTO_INCREMENT, - NAME varchar(100) not null, - TITLE varchar(100), - PRIMARY KEY ( ID ) -);