Skip to content

Commit fdebcea

Browse files
SNOW-1903631: Improve test assertions in datasource (#2067)
1 parent f8b89f6 commit fdebcea

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/java/net/snowflake/client/jdbc/SnowflakeBasicDataSourceTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ public void testDataSourceWithoutUsernameOrPasswordThrowsExplicitException() {
120120

121121
ds.setAccount("testaccount");
122122
ds.setAuthenticator("snowflake");
123-
assertThrows(
124-
SnowflakeSQLException.class,
125-
ds::getConnection,
126-
"Cannot create connection because username is missing in DataSource properties.");
123+
Exception e = assertThrows(SnowflakeSQLException.class, ds::getConnection);
124+
assertEquals(
125+
"Cannot create connection because username is missing in DataSource properties.",
126+
e.getMessage());
127127

128128
ds.setUser("testuser");
129-
assertThrows(
130-
SnowflakeSQLException.class,
131-
ds::getConnection,
132-
"Cannot create connection because password is missing in DataSource properties.");
129+
e = assertThrows(SnowflakeSQLException.class, ds::getConnection);
130+
assertEquals(
131+
"Cannot create connection because password is missing in DataSource properties.",
132+
e.getMessage());
133133
}
134134
}

0 commit comments

Comments
 (0)