Fixed BadSqlGrammarException usage in transaction test suite
Issue: SPR-10902
This commit is contained in:
parent
30b3e24a32
commit
ef66708aa6
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.test.context.junit4;
|
||||
|
||||
import org.springframework.jdbc.BadSqlGrammarException;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.test.annotation.NotTransactional;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -54,7 +54,7 @@ public abstract class AbstractTransactionalSpringRunnerTests {
|
|||
try {
|
||||
simpleJdbcTemplate.update("CREATE TABLE person (name VARCHAR(20) NOT NULL, PRIMARY KEY(name))");
|
||||
}
|
||||
catch (BadSqlGrammarException bsge) {
|
||||
catch (DataAccessException dae) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,31 +16,28 @@
|
|||
|
||||
package org.springframework.test.context.junit4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction;
|
||||
import static org.springframework.test.transaction.TransactionTestUtils.inTransaction;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.tests.sample.beans.Employee;
|
||||
import org.springframework.tests.sample.beans.Pet;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.BadSqlGrammarException;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.test.annotation.NotTransactional;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.transaction.AfterTransaction;
|
||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||
import org.springframework.test.jdbc.SimpleJdbcTestUtils;
|
||||
import org.springframework.tests.sample.beans.Employee;
|
||||
import org.springframework.tests.sample.beans.Pet;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.test.transaction.TransactionTestUtils.*;
|
||||
|
||||
/**
|
||||
* Combined integration test for {@link AbstractJUnit4SpringContextTests} and
|
||||
|
@ -87,7 +84,7 @@ public class ConcreteTransactionalJUnit4SpringContextTests extends AbstractTrans
|
|||
try {
|
||||
simpleJdbcTemplate.update("CREATE TABLE person (name VARCHAR(20) NOT NULL, PRIMARY KEY(name))");
|
||||
}
|
||||
catch (final BadSqlGrammarException bsge) {
|
||||
catch (DataAccessException dae) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue