Use JdbcTestUtils where appropriate in tests

This commit is contained in:
Mahmoud Ben Hassine
2021-08-26 22:12:34 +02:00
parent 3742931c4c
commit de9ce2d0cc
30 changed files with 154 additions and 125 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.annotation.Repeat;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.jdbc.JdbcTestUtils;
/**
* This is an abstract test class.
@@ -61,7 +62,7 @@ public abstract class AbstractSampleJobTests {
@After
public void tearDown() {
this.jdbcTemplate.update("drop table TESTS");
JdbcTestUtils.dropTables(this.jdbcTemplate, "TESTS");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.jdbc.JdbcTestUtils;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/sample-steps.xml" })
@@ -58,7 +59,7 @@ public class SampleStepTests implements ApplicationContextAware {
@After
public void tearDown() {
this.jdbcTemplate.update("drop table TESTS");
JdbcTestUtils.dropTables(this.jdbcTemplate, "TESTS");
}
@Test