Fixed formating and removed unused files
This commit is contained in:
parent
8c44ab9b80
commit
29adc66375
@ -13,38 +13,38 @@ import javax.persistence.Table;
|
|||||||
@Table(name = "employees")
|
@Table(name = "employees")
|
||||||
public class Employee {
|
public class Employee {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
public Employee() {
|
public Employee() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Employee(String name, String title) {
|
public Employee(String name, String title) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,17 +19,17 @@ import com.baeldung.boot.repository.EmployeeRepository;
|
|||||||
@Sql({ "/employees_schema.sql", "/import_employees.sql" })
|
@Sql({ "/employees_schema.sql", "/import_employees.sql" })
|
||||||
public class SpringBootInitialLoadTest {
|
public class SpringBootInitialLoadTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeRepository employeeRepository;
|
private EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDataForTestClass() {
|
public void testLoadDataForTestClass() {
|
||||||
assertEquals(employeeRepository.findAll().size(), 3);
|
assertEquals(employeeRepository.findAll().size(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Sql(scripts = {"/import_senior_employees.sql" }
|
@Sql(scripts = {"/import_senior_employees.sql" }
|
||||||
, config = @SqlConfig(encoding = "utf-8", transactionMode = TransactionMode.ISOLATED))
|
, config = @SqlConfig(encoding = "utf-8", transactionMode = TransactionMode.ISOLATED))
|
||||||
public void testLoadDataForTestCase() {
|
public void testLoadDataForTestCase() {
|
||||||
assertEquals(employeeRepository.findAll().size(), 5);
|
assertEquals(employeeRepository.findAll().size(), 5);
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,11 @@ package com.baeldung.springbootinitialload.tests;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.jdbc.Sql;
|
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;
|
||||||
import org.springframework.test.context.jdbc.SqlConfig.TransactionMode;
|
import org.springframework.test.context.jdbc.SqlConfig.TransactionMode;
|
||||||
import org.springframework.test.context.jdbc.SqlGroup;
|
import org.springframework.test.context.jdbc.SqlGroup;
|
||||||
@ -19,17 +17,16 @@ import com.baeldung.boot.repository.EmployeeRepository;
|
|||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = Application.class)
|
@SpringBootTest(classes = Application.class)
|
||||||
@SqlGroup({
|
@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
|
||||||
@Sql(scripts = "/employees_schema_with_comments.sql", config = @SqlConfig(encoding = "utf-8", commentPrefix = "\\", transactionMode = TransactionMode.ISOLATED)),
|
@Sql("/import_employees.sql")})
|
||||||
@Sql("/import_employees.sql"),
|
|
||||||
@Sql(executionPhase = ExecutionPhase.AFTER_TEST_METHOD, scripts = { "/drop_employees.sql" }) })
|
|
||||||
public class SpringBootSqlGroupAnnotationTest {
|
public class SpringBootSqlGroupAnnotationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeRepository employeeRepository;
|
private EmployeeRepository employeeRepository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDataForTestCase() {
|
public void testLoadDataForTestCase() {
|
||||||
assertEquals(employeeRepository.findAll().size(), 3);
|
assertEquals(employeeRepository.findAll()
|
||||||
}
|
.size(), 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
drop table if exists EMPLOYEES;
|
|
@ -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 )
|
|
||||||
);
|
|
Loading…
x
Reference in New Issue
Block a user