mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
Convert test/jdk/java/sql/junit/test/sql/ param tests to ensure original semantics
This commit is contained in:
parent
b671bcf1f3
commit
447aabe47d
@ -54,7 +54,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedLiteralValues")
|
||||
public void test00(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, cstmt.enquoteLiteral(s));
|
||||
@ -72,7 +72,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that enquoteIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedIdentifierValues")
|
||||
public void test02(String s, boolean alwaysQuote, String expected) throws SQLException {
|
||||
assertEquals(expected, cstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -82,7 +82,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
* Validate that a SQLException is thrown for values that are not valid
|
||||
* for a SQL identifier
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> cstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -92,7 +92,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
* Validate a NullPointerException is thrown is the string passed to
|
||||
* enquoteIdentiifer is null
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> cstmt.enquoteIdentifier(null, alwaysQuote));
|
||||
@ -101,7 +101,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that isSimpleIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("simpleIdentifierValues")
|
||||
public void test05(String s, boolean expected) throws SQLException {
|
||||
assertEquals(expected, cstmt.isSimpleIdentifier(s));
|
||||
@ -120,7 +120,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedNCharLiteralValues")
|
||||
public void test07(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, cstmt.enquoteNCharLiteral(s));
|
||||
|
||||
@ -48,7 +48,7 @@ public class ConnectionTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedLiteralValues")
|
||||
public void test00(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, conn.enquoteLiteral(s));
|
||||
@ -66,7 +66,7 @@ public class ConnectionTests extends BaseTest {
|
||||
/*
|
||||
* Validate that enquoteIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedIdentifierValues")
|
||||
public void test02(String s, boolean alwaysQuote, String expected) throws SQLException {
|
||||
assertEquals(expected, conn.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -76,7 +76,7 @@ public class ConnectionTests extends BaseTest {
|
||||
* Validate that a SQLException is thrown for values that are not valid
|
||||
* for a SQL identifier
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> conn.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -86,7 +86,7 @@ public class ConnectionTests extends BaseTest {
|
||||
* Validate a NullPointerException is thrown is the string passed to
|
||||
* enquoteIdentiifer is null
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> conn.enquoteIdentifier(null, alwaysQuote));
|
||||
@ -95,7 +95,7 @@ public class ConnectionTests extends BaseTest {
|
||||
/*
|
||||
* Validate that isSimpleIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("simpleIdentifierValues")
|
||||
public void test05(String s, boolean expected) throws SQLException {
|
||||
assertEquals(expected, conn.isSimpleIdentifier(s));
|
||||
@ -114,7 +114,7 @@ public class ConnectionTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedNCharLiteralValues")
|
||||
public void test07(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, conn.enquoteNCharLiteral(s));
|
||||
|
||||
@ -38,7 +38,7 @@ public class DateTests extends BaseTest {
|
||||
/*
|
||||
* Validate an IllegalArgumentException is thrown for an invalid Date string
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidDateValues")
|
||||
public void test(String d) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Date.valueOf(d));
|
||||
@ -48,7 +48,7 @@ public class DateTests extends BaseTest {
|
||||
* Test that a date created from a date string is equal to the value
|
||||
* returned from toString()
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validDateValues")
|
||||
public void test00(String d, String expectedD) {
|
||||
Date d1 = Date.valueOf(d);
|
||||
|
||||
@ -67,7 +67,7 @@ public class JavatimeTest {
|
||||
return Arguments.of(millis, nanos, ldt, secs, nanos_ms);
|
||||
}).toList();
|
||||
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@FieldSource("DATE_TIME_ARGS")
|
||||
void timestampTest(long millis, int nanos, LocalDateTime ldt, long secs) {
|
||||
Timestamp ta = new Timestamp(millis);
|
||||
@ -94,7 +94,7 @@ public class JavatimeTest {
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@FieldSource("DATE_TIME_ARGS")
|
||||
void sqlDateTest(long millis, int nanos, LocalDateTime ldt) {
|
||||
// j.s.d/t uses j.u.d.equals() !!!!!!!!
|
||||
@ -107,7 +107,7 @@ public class JavatimeTest {
|
||||
errMsg("ld -> j.s.d", millis, nanos, ldt, results(ld, java.sql.Date.valueOf(ld))));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@FieldSource("DATE_TIME_ARGS")
|
||||
void sqlTimeTest(long millis, int nanos, LocalDateTime ldt, long secs, int nanos_ms) {
|
||||
java.sql.Time jst = new java.sql.Time(millis);
|
||||
|
||||
@ -55,7 +55,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedLiteralValues")
|
||||
public void test00(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, pstmt.enquoteLiteral(s));
|
||||
@ -73,7 +73,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that enquoteIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedIdentifierValues")
|
||||
public void test02(String s, boolean alwaysQuote, String expected) throws SQLException {
|
||||
assertEquals(expected, pstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -83,7 +83,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
* Validate that a SQLException is thrown for values that are not valid
|
||||
* for a SQL identifier
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> pstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -93,7 +93,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
* Validate a NullPointerException is thrown is the string passed to
|
||||
* enquoteIdentiifer is null
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> pstmt.enquoteIdentifier(null, alwaysQuote));
|
||||
@ -102,7 +102,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that isSimpleIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("simpleIdentifierValues")
|
||||
public void test05(String s, boolean expected) throws SQLException {
|
||||
assertEquals(expected, pstmt.isSimpleIdentifier(s));
|
||||
@ -121,7 +121,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedNCharLiteralValues")
|
||||
public void test07(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, pstmt.enquoteNCharLiteral(s));
|
||||
|
||||
@ -54,7 +54,7 @@ public class StatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedLiteralValues")
|
||||
public void test00(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, stmt.enquoteLiteral(s));
|
||||
@ -72,7 +72,7 @@ public class StatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that enquoteIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedIdentifierValues")
|
||||
public void test02(String s, boolean alwaysQuote, String expected) throws SQLException {
|
||||
assertEquals(expected, stmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -82,7 +82,7 @@ public class StatementTests extends BaseTest {
|
||||
* Validate that a SQLException is thrown for values that are not valid
|
||||
* for a SQL identifier
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> stmt.enquoteIdentifier(s, alwaysQuote));
|
||||
@ -92,7 +92,7 @@ public class StatementTests extends BaseTest {
|
||||
* Validate a NullPointerException is thrown is the string passed to
|
||||
* enquoteIdentiifer is null
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> stmt.enquoteIdentifier(null, alwaysQuote));
|
||||
@ -101,7 +101,7 @@ public class StatementTests extends BaseTest {
|
||||
/*
|
||||
* Validate that isSimpleIdentifier returns the expected value
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("simpleIdentifierValues")
|
||||
public void test05(String s, boolean expected) throws SQLException {
|
||||
assertEquals(expected, stmt.isSimpleIdentifier(s));
|
||||
@ -120,7 +120,7 @@ public class StatementTests extends BaseTest {
|
||||
* Verify that enquoteLiteral creates a valid literal and converts every
|
||||
* single quote to two single quotes
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validEnquotedNCharLiteralValues")
|
||||
public void test07(String s, String expected) throws SQLException {
|
||||
assertEquals(expected, stmt.enquoteNCharLiteral(s));
|
||||
|
||||
@ -153,7 +153,7 @@ public class TimeTests extends BaseTest {
|
||||
* toString() of the other and that the correct value is returned from
|
||||
* toString()
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validTimeValues")
|
||||
public void test13(String time, String expected) {
|
||||
Time t1 = Time.valueOf(time);
|
||||
@ -187,7 +187,7 @@ public class TimeTests extends BaseTest {
|
||||
/*
|
||||
* Validate an IllegalArgumentException is thrown for an invalid Time string
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidTimeValues")
|
||||
public void test16(String time) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Time.valueOf(time));
|
||||
|
||||
@ -68,7 +68,7 @@ public class TimestampTests extends BaseTest {
|
||||
/*
|
||||
* Validate an IllegalArgumentException is thrown for an invalid Timestamp
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("invalidTimestampValues")
|
||||
public void test(String ts) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Timestamp.valueOf(ts));
|
||||
@ -223,7 +223,7 @@ public class TimestampTests extends BaseTest {
|
||||
* Validate that two Timestamps are equal when one is created from the
|
||||
* toString() of the other
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validTimestampValues")
|
||||
public void test13(String ts, String expectedTS) {
|
||||
Timestamp ts1 = Timestamp.valueOf(ts);
|
||||
@ -633,7 +633,7 @@ public class TimestampTests extends BaseTest {
|
||||
* Validate that two Timestamps are equal when one is created from the
|
||||
* toString() of the other
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validateNanos")
|
||||
public void test51(String ts, int nanos) {
|
||||
Timestamp ts1 = Timestamp.valueOf(ts);
|
||||
@ -642,7 +642,7 @@ public class TimestampTests extends BaseTest {
|
||||
"Error with Nanos");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(autoCloseArguments = false)
|
||||
@MethodSource("validTimestampLongValues")
|
||||
public void test52(long value, String ts) {
|
||||
Timestamp ts1 = new Timestamp(value);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user