[BAEL-2749] Indentation and annotations format

This commit is contained in:
Joao Esperancinha 2020-04-02 11:20:34 +02:00
parent 064e16251b
commit f06af64998
5 changed files with 310 additions and 281 deletions

View File

@ -28,7 +28,8 @@ public class DataSourceDBUnitTest extends DataSourceBasedDBTestCase {
private static final Logger logger = LoggerFactory.getLogger(DataSourceDBUnitTest.class);
@Override protected javax.sql.DataSource getDataSource() {
@Override
protected javax.sql.DataSource getDataSource() {
JdbcDataSource dataSource = new JdbcDataSource();
dataSource.setURL(JDBC_URL);
dataSource.setUser("sa");
@ -36,29 +37,35 @@ public class DataSourceDBUnitTest extends DataSourceBasedDBTestCase {
return dataSource;
}
@Override protected IDataSet getDataSet() throws Exception {
@Override
protected IDataSet getDataSet() throws Exception {
try (InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("dbunit/data.xml")) {
return new FlatXmlDataSetBuilder().build(resourceAsStream);
}
}
@Override protected DatabaseOperation getSetUpOperation() {
@Override
protected DatabaseOperation getSetUpOperation() {
return DatabaseOperation.REFRESH;
}
@Override protected DatabaseOperation getTearDownOperation() {
@Override
protected DatabaseOperation getTearDownOperation() {
return DatabaseOperation.DELETE_ALL;
}
@Before public void setUp() throws Exception {
@Before
public void setUp() throws Exception {
super.setUp();
}
@After public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
super.tearDown();
}
@Test public void testSimpleDataSet() throws SQLException {
@Test
public void testSimpleDataSet() throws SQLException {
final Connection connection = getDataSource().getConnection();
final ResultSet rs = connection.createStatement().executeQuery("select * from ITEMS where id = 1");
@ -67,7 +74,8 @@ public class DataSourceDBUnitTest extends DataSourceBasedDBTestCase {
assertThat(rs.getString("title")).isEqualTo("Grey T-Shirt");
}
@Test public void testEmptySchema() throws Exception {
@Test
public void testEmptySchema() throws Exception {
final IDataSet expectedDataSet = getDataSet();
final ITable expectedTable = expectedDataSet.getTable("CLIENTS");
final IDataSet databaseDataSet = getConnection().createDataSet();
@ -75,7 +83,8 @@ public class DataSourceDBUnitTest extends DataSourceBasedDBTestCase {
Assertion.assertEquals(expectedTable, actualTable);
}
@Test public void testAssertByQuery() throws Exception {
@Test
public void testAssertByQuery() throws Exception {
try (final InputStream is = getClass().getClassLoader().getResourceAsStream("dbunit/expected-user.xml")) {
final IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(is);
final ITable expectedTable = expectedDataSet.getTable("CLIENTS");
@ -88,7 +97,8 @@ public class DataSourceDBUnitTest extends DataSourceBasedDBTestCase {
}
}
@Test public void testMultipleFailures() throws Exception {
@Test
public void testMultipleFailures() throws Exception {
try (final InputStream is = getClass().getClassLoader().getResourceAsStream("dbunit/expected-multiple-failures.xml")) {
final IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(is);
final ITable expectedTable = expectedDataSet.getTable("ITEMS");

View File

@ -29,21 +29,25 @@ public class DbUnitTest extends DBTestCase {
System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD, PASSWORD);
}
@Override protected IDataSet getDataSet() throws Exception {
@Override
protected IDataSet getDataSet() throws Exception {
try (final InputStream is = DbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/data.xml")) {
return new FlatXmlDataSetBuilder().build(is);
}
}
@Override protected DatabaseOperation getSetUpOperation() {
@Override
protected DatabaseOperation getSetUpOperation() {
return DatabaseOperation.REFRESH;
}
@Override protected DatabaseOperation getTearDownOperation() {
@Override
protected DatabaseOperation getTearDownOperation() {
return DatabaseOperation.DELETE_ALL;
}
@Test public void testSelect() throws Exception {
@Test
public void testSelect() throws Exception {
final Connection connection = getConnection().getConnection();
final ResultSet rs = connection.createStatement().executeQuery("select * from ITEMS where id = 1");
@ -52,7 +56,8 @@ public class DbUnitTest extends DBTestCase {
assertThat(rs.getString("title")).isEqualTo("Grey T-Shirt");
}
@Test public void testDelete() throws Exception {
@Test
public void testDelete() throws Exception {
final Connection connection = getConnection().getConnection();
try (final InputStream is = DbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_delete.xml")) {
@ -67,7 +72,8 @@ public class DbUnitTest extends DBTestCase {
}
}
@Test public void testUpdate() throws Exception {
@Test
public void testUpdate() throws Exception {
final Connection connection = getConnection().getConnection();
try (final InputStream is = DbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_rename.xml")) {

View File

@ -28,7 +28,8 @@ public class OldSchoolDbUnitTest {
private static IDatabaseTester tester = null;
@BeforeClass public static void setUp() throws Exception {
@BeforeClass
public static void setUp() throws Exception {
tester = initDatabaseTester();
}
@ -46,15 +47,18 @@ public class OldSchoolDbUnitTest {
}
}
@Before public void setup() throws Exception {
@Before
public void setup() throws Exception {
tester.onSetup();
}
@After public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
tester.onTearDown();
}
@Test public void testSelect() throws Exception {
@Test
public void testSelect() throws Exception {
final Connection connection = tester.getConnection().getConnection();
final ResultSet rs = connection.createStatement().executeQuery("select * from ITEMS where id = 1");
@ -63,7 +67,8 @@ public class OldSchoolDbUnitTest {
assertThat(rs.getString("title")).isEqualTo("Grey T-Shirt");
}
@Test public void testIgnoringProduced() throws Exception {
@Test
public void testIgnoringProduced() throws Exception {
final Connection connection = tester.getConnection().getConnection();
final String[] excludedColumns = { "id", "produced" };
try (final InputStream is = getClass().getClassLoader().getResourceAsStream("dbunit/expected-ignoring-registered_at.xml")) {
@ -79,7 +84,8 @@ public class OldSchoolDbUnitTest {
}
}
@Test public void testDelete() throws Exception {
@Test
public void testDelete() throws Exception {
final Connection connection = tester.getConnection().getConnection();
try (final InputStream is = OldSchoolDbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_delete.xml")) {
@ -94,7 +100,8 @@ public class OldSchoolDbUnitTest {
}
}
@Test public void testDeleteWithExcludedColumns() throws Exception {
@Test
public void testDeleteWithExcludedColumns() throws Exception {
final Connection connection = tester.getConnection().getConnection();
try (final InputStream is = OldSchoolDbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_delete_no_produced.xml")) {
@ -110,7 +117,8 @@ public class OldSchoolDbUnitTest {
}
}
@Test public void testUpdate() throws Exception {
@Test
public void testUpdate() throws Exception {
final Connection connection = tester.getConnection().getConnection();
try (final InputStream is = OldSchoolDbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_rename.xml")) {
@ -125,7 +133,8 @@ public class OldSchoolDbUnitTest {
}
}
@Test public void testUpdateWithExcludedColumns() throws Exception {
@Test
public void testUpdateWithExcludedColumns() throws Exception {
final Connection connection = tester.getConnection().getConnection();
try (final InputStream is = OldSchoolDbUnitTest.class.getClassLoader().getResourceAsStream("dbunit/items_exp_rename_no_produced.xml")) {

View File

@ -24,7 +24,8 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PrepAndExpectedDbUnitTest extends DefaultPrepAndExpectedTestCase {
@Override public void setUp() throws Exception {
@Override
public void setUp() throws Exception {
setDatabaseTester(initDatabaseTester());
setDataFileLoader(initDataFileLoader());
super.setUp();
@ -47,7 +48,8 @@ public class PrepAndExpectedDbUnitTest extends DefaultPrepAndExpectedTestCase {
return new FlatXmlDataFileLoader();
}
@Test public void testSelect() throws Exception {
@Test
public void testSelect() throws Exception {
final Connection connection = getConnection().getConnection();
final VerifyTableDefinition[] verifyTables = { new VerifyTableDefinition("CLIENTS", new String[] {}) };
final String[] prepDataFiles = { "/dbunit/users.xml" };
@ -60,7 +62,8 @@ public class PrepAndExpectedDbUnitTest extends DefaultPrepAndExpectedTestCase {
assertThat(rs.getString("last_name")).isEqualTo("Xavier");
}
@Test public void testUpdate() throws Exception {
@Test
public void testUpdate() throws Exception {
final Connection connection = getConnection().getConnection();
final VerifyTableDefinition[] verifyTables = { new VerifyTableDefinition("CLIENTS", new String[] {}) }; // define tables to verify
final String[] prepDataFiles = { "/dbunit/users.xml" };
@ -70,7 +73,8 @@ public class PrepAndExpectedDbUnitTest extends DefaultPrepAndExpectedTestCase {
super.runTest(verifyTables, prepDataFiles, expectedDataFiles, testSteps);
}
@Test public void testDelete() throws Exception {
@Test
public void testDelete() throws Exception {
final Connection connection = getConnection().getConnection();
final VerifyTableDefinition[] verifyTables = { new VerifyTableDefinition("CLIENTS", new String[] {}) };
final String[] prepDataFiles = { "/dbunit/users.xml" };