org.springframework.test.context.jdbc.SqlConfig Java Examples

The following examples show how to use org.springframework.test.context.jdbc.SqlConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserServiceTest.java    From Spring with Apache License 2.0 6 votes vote down vote up
@Test
@SqlGroup({
        @Sql(
                value = "classpath:db/extra-data.sql",
                config = @SqlConfig(encoding = "utf-8", separator = ";", commentPrefix = "--")
        ),
        @Sql(
                scripts = "classpath:db/delete-test-data.sql",
                config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED),
                executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD
        )
})
public void testCount() {
    int count = userService.countUsers();
    assertEquals(8, count);
}
 
Example #2
Source File: SqlConfigInterfaceTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
@Sql(scripts = "/org/springframework/test/context/jdbc/schema.sql", //
		config = @SqlConfig(separator = ";"))
@Sql("/org/springframework/test/context/jdbc/data-add-users-with-custom-script-syntax.sql")
public void methodLevelScripts() {
	assertNumUsers(3);
}
 
Example #3
Source File: SqlConfigInterfaceTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
@Sql(scripts = "/org/springframework/test/context/jdbc/schema.sql", //
		config = @SqlConfig(separator = ";"))
@Sql("/org/springframework/test/context/jdbc/data-add-users-with-custom-script-syntax.sql")
public void methodLevelScripts() {
	assertNumUsers(3);
}
 
Example #4
Source File: UserServiceTest.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Test
@SqlGroup({
        @Sql(value = "classpath:db/extra-data.sql", config = @SqlConfig(encoding = "utf-8", separator = ";", commentPrefix = "--")),
        @Sql(
                scripts = "classpath:db/delete-test-data.sql",
                config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED),
                executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD
        )
})
public void testCount() {
    int count = userService.countUsers();
    assertEquals(8, count);
}
 
Example #5
Source File: SpringBootInitialLoadIntegrationTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
@Sql(scripts = {"/import_senior_employees.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = TransactionMode.ISOLATED))
public void testLoadDataForTestCase() {
    assertEquals(5, employeeRepository.findAll()
        .size());
}