mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
Clean up exception tests (lambdas + narrow scope)
This commit is contained in:
parent
757e796666
commit
e03fc627fa
@ -68,9 +68,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test01() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
cstmt.enquoteLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> cstmt.enquoteLiteral(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -89,9 +87,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
cstmt.enquoteIdentifier(s, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> cstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -101,9 +97,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
cstmt.enquoteIdentifier(null, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> cstmt.enquoteIdentifier(null, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -121,9 +115,7 @@ public class CallableStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test06() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
cstmt.isSimpleIdentifier(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> cstmt.isSimpleIdentifier(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -142,8 +134,6 @@ public class CallableStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test08() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
cstmt.enquoteNCharLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> cstmt.enquoteNCharLiteral(null));
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,9 +62,7 @@ public class ConnectionTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test01() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
conn.enquoteLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> conn.enquoteLiteral(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -83,9 +81,7 @@ public class ConnectionTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
conn.enquoteIdentifier(s, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> conn.enquoteIdentifier(s, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -95,9 +91,7 @@ public class ConnectionTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
conn.enquoteIdentifier(null, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> conn.enquoteIdentifier(null, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -115,9 +109,7 @@ public class ConnectionTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test06() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
conn.isSimpleIdentifier(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> conn.isSimpleIdentifier(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -136,8 +128,6 @@ public class ConnectionTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test08() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
conn.enquoteNCharLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> conn.enquoteNCharLiteral(null));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,9 +44,7 @@ public class DateTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidDateValues")
|
||||
public void test(String d) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date.valueOf(d);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Date.valueOf(d));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -218,10 +216,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test15() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
LocalDate ld = null;
|
||||
Date.valueOf(ld);
|
||||
});
|
||||
LocalDate ld = null;
|
||||
Assertions.assertThrows(NullPointerException.class, () -> Date.valueOf(ld));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -230,10 +226,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test16() throws Exception {
|
||||
Assertions.assertThrows(UnsupportedOperationException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Instant instant = d.toInstant();
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(UnsupportedOperationException.class, d::toInstant);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -286,10 +280,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test21() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.getHours();
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, d::getHours);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -297,10 +289,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test22() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.getMinutes();
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, d::getMinutes);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -308,10 +298,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test23() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.getSeconds();
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, d::getSeconds);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -319,10 +307,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test24() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.setHours(8);
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> d.setHours(8));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -330,10 +316,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test25() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.setMinutes(0);
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> d.setMinutes(0));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -341,10 +325,8 @@ public class DateTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test26() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
d.setSeconds(0);
|
||||
});
|
||||
Date d = Date.valueOf("1961-08-30");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> d.setSeconds(0));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -127,10 +127,9 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test1() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
Driver d = null;
|
||||
DriverManager.registerDriver(d);
|
||||
});
|
||||
Driver d = null;
|
||||
Assertions.assertThrows(NullPointerException.class,
|
||||
() -> DriverManager.registerDriver(d));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,10 +138,9 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test2() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
Driver d = null;
|
||||
DriverManager.registerDriver(d, null);
|
||||
});
|
||||
Driver d = null;
|
||||
Assertions.assertThrows(NullPointerException.class, () ->
|
||||
DriverManager.registerDriver(d, null));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,9 +158,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test4() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(InvalidURL);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(InvalidURL));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,9 +167,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test5() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(InvalidURL, new Properties());
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(InvalidURL, new Properties()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,9 +176,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test6() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(InvalidURL, "LuckyDog", "tennisanyone");
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(InvalidURL, "LuckyDog", "tennisanyone"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,9 +184,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test7() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(null);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(null));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,9 +192,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test8() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(null, new Properties());
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(null, new Properties()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -212,9 +200,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test9() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getConnection(null, "LuckyDog", "tennisanyone");
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getConnection(null, "LuckyDog", "tennisanyone"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,9 +209,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test10() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getDriver(InvalidURL);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getDriver(InvalidURL));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -233,9 +217,7 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test11() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.getDriver(null);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getDriver(null));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,10 +237,8 @@ public class DriverManagerTests {
|
||||
*/
|
||||
@Test
|
||||
public void test13() throws Exception {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
DriverManager.registerDriver(new StubDriver());
|
||||
DriverManager.getDriver(InvalidURL);
|
||||
});
|
||||
DriverManager.registerDriver(new StubDriver());
|
||||
Assertions.assertThrows(SQLException.class, () -> DriverManager.getDriver(InvalidURL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -69,9 +69,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test01() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
pstmt.enquoteLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> pstmt.enquoteLiteral(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -90,9 +88,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
pstmt.enquoteIdentifier(s, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> pstmt.enquoteIdentifier(s, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -102,9 +98,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
pstmt.enquoteIdentifier(null, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> pstmt.enquoteIdentifier(null, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -122,9 +116,7 @@ public class PreparedStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test06() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
pstmt.isSimpleIdentifier(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> pstmt.isSimpleIdentifier(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -143,8 +135,6 @@ public class PreparedStatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test08() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
pstmt.enquoteNCharLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> pstmt.enquoteNCharLiteral(null));
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,9 +68,7 @@ public class StatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test01() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
stmt.enquoteLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> stmt.enquoteLiteral(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -89,9 +87,7 @@ public class StatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidEnquotedIdentifierValues")
|
||||
public void test03(String s, boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(SQLException.class, () -> {
|
||||
stmt.enquoteIdentifier(s, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(SQLException.class, () -> stmt.enquoteIdentifier(s, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -101,9 +97,7 @@ public class StatementTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
public void test04(boolean alwaysQuote) throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
stmt.enquoteIdentifier(null, alwaysQuote);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> stmt.enquoteIdentifier(null, alwaysQuote));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -121,9 +115,7 @@ public class StatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test06() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
stmt.isSimpleIdentifier(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> stmt.isSimpleIdentifier(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -142,8 +134,6 @@ public class StatementTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test08() throws SQLException {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
stmt.enquoteNCharLiteral(null);
|
||||
});
|
||||
Assertions.assertThrows(NullPointerException.class, () -> stmt.enquoteNCharLiteral(null));
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,10 +42,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test01() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.getYear();
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, t::getYear);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -53,10 +51,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test02() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.getMonth();
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, t::getMonth);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -64,10 +60,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test03() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.getDay();
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, t::getDay);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,10 +69,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test04() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.getDate();
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, t::getDate);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -86,10 +78,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test05() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.setYear(8);
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> t.setYear(8));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -97,10 +87,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test06() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.setMonth(8);
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> t.setMonth(8));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -108,10 +96,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test07() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.setDate(30);
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> t.setDate(30));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -119,10 +105,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test08() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
t.getDate();
|
||||
});
|
||||
Time t = Time.valueOf("08:30:59");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, t::getDate);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -152,10 +136,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test11() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
LocalTime ld = null;
|
||||
Time.valueOf(ld);
|
||||
});
|
||||
LocalTime ld = null;
|
||||
Assertions.assertThrows(NullPointerException.class, () -> Time.valueOf(ld));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -164,10 +146,8 @@ public class TimeTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test12() throws Exception {
|
||||
Assertions.assertThrows(UnsupportedOperationException.class, () -> {
|
||||
Time t = new Time(System.currentTimeMillis());
|
||||
t.toInstant();
|
||||
});
|
||||
Time t = new Time(System.currentTimeMillis());
|
||||
Assertions.assertThrows(UnsupportedOperationException.class, t::toInstant);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -212,9 +192,7 @@ public class TimeTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidTimeValues")
|
||||
public void test16(String time) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Time.valueOf(time);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Time.valueOf(time));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -73,9 +73,7 @@ public class TimestampTests extends BaseTest {
|
||||
@ParameterizedTest
|
||||
@MethodSource("invalidTimestampValues")
|
||||
public void test(String ts) throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Timestamp.valueOf(ts);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> Timestamp.valueOf(ts));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -274,10 +272,8 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test17() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634");
|
||||
ts1.before(null);
|
||||
});
|
||||
Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634");
|
||||
Assertions.assertThrows(NullPointerException.class, () -> ts1.before(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -329,10 +325,8 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test22() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
|
||||
ts1.after(null);
|
||||
});
|
||||
Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
|
||||
Assertions.assertThrows(NullPointerException.class, () -> ts1.after(null));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -491,10 +485,8 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test38() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
|
||||
ts1.setNanos(-1);
|
||||
});
|
||||
Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> ts1.setNanos(-1));
|
||||
|
||||
}
|
||||
|
||||
@ -503,11 +495,9 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test39() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
int nanos = 999999999;
|
||||
Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
|
||||
ts1.setNanos(nanos + 1);
|
||||
});
|
||||
int nanos = 999999999;
|
||||
Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> ts1.setNanos(nanos + 1));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -560,10 +550,8 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test44() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
LocalDateTime ldt = null;
|
||||
Timestamp.valueOf(ldt);
|
||||
});
|
||||
LocalDateTime ldt = null;
|
||||
Assertions.assertThrows(NullPointerException.class, () -> Timestamp.valueOf(ldt));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -593,10 +581,8 @@ public class TimestampTests extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void test47() throws Exception {
|
||||
Assertions.assertThrows(NullPointerException.class, () -> {
|
||||
Instant instant = null;
|
||||
Timestamp.from(instant);
|
||||
});
|
||||
Instant instant = null;
|
||||
Assertions.assertThrows(NullPointerException.class, () -> Timestamp.from(instant));
|
||||
}
|
||||
|
||||
// Added SQE tests
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user