Skip to content

Commit 2f11543

Browse files
committed
Add tests
1 parent 098b10e commit 2f11543

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

jdbc/src/test/java/tech/ydb/jdbc/YdbDriverStaticCredsTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,23 @@ public void connectOK() throws SQLException {
9393
@Test
9494
public void connectWrong() throws SQLException {
9595
wrongConnection(connectByProperties("user1", "a"));
96+
wrongConnection(connectByAuthority("user1", "a"));
9697

9798
wrongConnection(connectByProperties("user2", ""));
9899
wrongConnection(connectByProperties("user2", null));
99100
wrongConnection(connectByProperties("user2", "pass"));
100101

102+
wrongConnection(connectByAuthority("user2", ""));
103+
wrongConnection(connectByAuthority("user2", null));
104+
wrongConnection(connectByAuthority("user2", "pass"));
105+
101106
wrongConnection(connectByProperties("user3", ""));
102107
wrongConnection(connectByProperties("user3", null));
103108
wrongConnection(connectByProperties("user3", "pw:ss;"));
109+
110+
wrongConnection(connectByAuthority("user3", ""));
111+
wrongConnection(connectByAuthority("user3", null));
112+
wrongConnection(connectByAuthority("user3", "pw:ss;"));
104113
}
105114

106115
interface ConnectionSupplier {

jdbc/src/test/java/tech/ydb/jdbc/impl/YdbResultSetImplTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.time.LocalDate;
2222
import java.time.LocalDateTime;
2323
import java.util.Collections;
24+
import java.util.Iterator;
2425
import java.util.Locale;
2526

2627
import javax.sql.rowset.serial.SerialBlob;
@@ -180,13 +181,17 @@ public void getMetaData() throws SQLException {
180181

181182
Assertions.assertEquals(22, metadata.getColumnCount());
182183

184+
Iterator<String> names = metadata.unwrap(YdbResultSetMetaData.class).getColumnNames().iterator();
183185
for (int index = 0; index < metadata.getColumnCount(); index++) {
184186
int column = index + 1;
185187
String name = metadata.getColumnName(column);
186188
Assertions.assertNotNull(name);
187189
Assertions.assertEquals(name, metadata.getColumnLabel(column));
188190
Assertions.assertEquals(column, ydbMetadata.getColumnIndex(name));
189191

192+
Assertions.assertTrue(names.hasNext());
193+
Assertions.assertEquals(name, names.next());
194+
190195
Assertions.assertFalse(metadata.isAutoIncrement(column), "All columns are not isAutoIncrement");
191196
Assertions.assertTrue(metadata.isCaseSensitive(column), "All columns are isCaseSensitive");
192197
Assertions.assertFalse(metadata.isSearchable(column), "All columns are not isSearchable");

0 commit comments

Comments
 (0)