INSERT INTO country (name) VALUES ('India');
INSERT INTO country (name) VALUES ('Brazil');
INSERT INTO country (name) VALUES ('USA');
INSERT INTO country (name) VALUES ('Italy');
@RunWith(SpringRunner.class)
@SpringBootTest(classes = LoadIniDataApp.class)
public class SpringBootInitialLoadIntegrationTest {
@Autowired
private CountryRepository countryRepository;
@Test
public void testInitDataForTestClass() {
assertEquals(4, countryRepository.count());
}
}
CREATE TABLE country (
id INTEGER NOT NULL AUTO_INCREMENT,
name VARCHAR(128) NOT NULL,
PRIMARY KEY (id)
);
spring.jpa.hibernate.ddl-auto=none
@Test
@Sql({"classpath:new_country.sql"})
public void testLoadDataForTestCase() {
assertEquals(6, countryRepository.count());
}