Skip to content

Commit c3f4213

Browse files
committed
refactor unit tests
1 parent 6a7b3af commit c3f4213

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseEnvironmentPropertiesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void setUp()
5050
}
5151

5252
@Test
53-
public void testSynapseConnectionString()
53+
public void connectionPropertiesToEnvironment_WithValidProperties_ReturnsCorrectConnectionString()
5454
{
5555
Map<String, String> synapseConnectionProperties = synapseEnvironmentProperties.connectionPropertiesToEnvironment(connectionProperties);
5656

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseJdbcConnectionFactoryTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private Connection createConnection(String jdbcUrl, CredentialsProvider credenti
9595
}
9696

9797
@Test
98-
public void testGetConnection_withCredentials_replacesSecret()
98+
public void getConnection_WithCredentials_ReplacesSecretInUrl()
9999
{
100100
Connection connection = createConnection(MOCK_JDBC_URL + SECRET_PLACEHOLDER,
101101
new StaticCredentialsProvider(new DefaultCredentials(TEST_USERNAME, TEST_PASSWORD)));
@@ -105,7 +105,7 @@ public void testGetConnection_withCredentials_replacesSecret()
105105
}
106106

107107
@Test
108-
public void testGetConnection_withActiveDirectoryServicePrincipal()
108+
public void getConnection_WithActiveDirectoryServicePrincipal_ReplacesSecretInUrl()
109109
{
110110
Connection connection = createConnection(
111111
MOCK_JDBC_URL + ACTIVE_DIRECTORY_AUTH + SECRET_PLACEHOLDER,
@@ -116,15 +116,15 @@ public void testGetConnection_withActiveDirectoryServicePrincipal()
116116
}
117117

118118
@Test
119-
public void testGetConnection_withNullCredentials_doesNotReplaceSecret()
119+
public void getConnection_WithNullCredentials_DoesNotReplaceSecret()
120120
{
121121
Connection connection = createConnection(MOCK_JDBC_URL + USER_PASSWORD_PARAMS, null);
122122
assertEquals(MOCK_JDBC_URL + USER_PASSWORD_PARAMS, actualUrl.get());
123123
assertEquals(mockConnection, connection);
124124
}
125125

126126
@Test(expected = RuntimeException.class)
127-
public void testGetConnection_whenDriverClassNotFound_throwsRuntimeException() throws SQLException
127+
public void getConnection_WhenDriverClassNotFound_ThrowsRuntimeException() throws SQLException
128128
{
129129
DatabaseConnectionConfig config = new DatabaseConnectionConfig(CATALOG, SYNAPSE, MOCK_JDBC_URL, SECRET_NAME);
130130

@@ -138,7 +138,7 @@ public void testGetConnection_whenDriverClassNotFound_throwsRuntimeException() t
138138
}
139139

140140
@Test(expected = RuntimeException.class)
141-
public void testGetConnection_whenDriverFailsToConnect_throwsRuntimeException() throws SQLException
141+
public void getConnection_WhenDriverFailsToConnect_ThrowsRuntimeException() throws SQLException
142142
{
143143
// Override the default mock behavior for this specific test
144144
when(mockDriver.connect(anyString(), any(Properties.class)))

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseMetadataHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void doListTables() throws Exception
480480
}
481481

482482
@Test
483-
public void testConvertDatasourceTypeToArrow_withSynapseSpecificTypes() throws SQLException {
483+
public void convertDatasourceTypeToArrow_WithSynapseSpecificTypes_ReturnsCorrectArrowTypes() throws SQLException {
484484
ResultSetMetaData metaData = mock(ResultSetMetaData.class);
485485
Map<String, String> configOptions = new HashMap<>();
486486
int precision = 0;
@@ -514,7 +514,7 @@ public void testConvertDatasourceTypeToArrow_withSynapseSpecificTypes() throws S
514514
}
515515

516516
@Test
517-
public void testDoDataTypeConversion_withAzureServerless() throws Exception {
517+
public void doGetTable_WithAzureServerless_ReturnsCorrectSchema() throws Exception {
518518
BlockAllocator blockAllocator = new BlockAllocatorImpl();
519519
String[] schema = {"DATA_TYPE", "COLUMN_NAME", "PRECISION", "SCALE"};
520520
int[] types = {Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER};

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseRecordHandlerTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void buildSplitSqlWithPartition()
200200
}
201201

202202
@Test
203-
public void testReadWithConstraint() throws Exception {
203+
public void readWithConstraint_WithValidData_ProcessesRows() throws Exception {
204204
Schema schema = SchemaBuilder.newBuilder()
205205
.addField(FieldBuilder.newBuilder(TEST_ID_COL, Types.MinorType.INT.getType()).build())
206206
.addField(FieldBuilder.newBuilder(TEST_NAME_COL, Types.MinorType.VARCHAR.getType()).build())
@@ -251,7 +251,7 @@ public void testReadWithConstraint() throws Exception {
251251
}
252252

253253
@Test
254-
public void buildSplitSqlWithOrderBy() throws SQLException {
254+
public void buildSplitSql_WithOrderBy_ReturnsCorrectSql() throws SQLException {
255255
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
256256
SchemaBuilder schemaBuilder = createSchemaWithCommonFields();
257257
schemaBuilder.addField(FieldBuilder.newBuilder(COL_VALUE, Types.MinorType.FLOAT8.getType()).build());
@@ -281,7 +281,7 @@ public void buildSplitSqlWithOrderBy() throws SQLException {
281281
}
282282

283283
@Test
284-
public void buildSqlWithComplexExpressions() throws SQLException {
284+
public void buildSplitSql_WithComplexExpressions_ReturnsCorrectSql() throws SQLException {
285285
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
286286
SchemaBuilder schemaBuilder = createSchemaWithCommonFields();
287287
schemaBuilder.addField(FieldBuilder.newBuilder(COL_DOUBLE, Types.MinorType.FLOAT8.getType()).build());
@@ -317,7 +317,7 @@ public void buildSqlWithComplexExpressions() throws SQLException {
317317
}
318318

319319
@Test
320-
public void buildSqlWithValueComparisons() throws SQLException {
320+
public void buildSplitSql_WithValueComparisons_ReturnsCorrectSql() throws SQLException {
321321
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
322322
SchemaBuilder schemaBuilder = createSchemaWithCommonFields();
323323
schemaBuilder.addField(FieldBuilder.newBuilder(COL_INT, Types.MinorType.INT.getType()).build());
@@ -353,7 +353,7 @@ public void buildSqlWithValueComparisons() throws SQLException {
353353
}
354354

355355
@Test
356-
public void testEmptyConstraints() throws SQLException {
356+
public void buildSplitSql_WithEmptyConstraints_ReturnsCorrectSql() throws SQLException {
357357
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
358358
Schema schema = createSchemaWithCommonFields().build();
359359
Split split = createMockSplit();
@@ -376,7 +376,7 @@ public void testEmptyConstraints() throws SQLException {
376376
}
377377

378378
@Test
379-
public void buildSplitSqlWithLimitOffset() throws SQLException {
379+
public void buildSplitSql_WithLimitOffset_ReturnsCorrectSql() throws SQLException {
380380
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
381381
Schema schema = createSchemaWithValueField().build();
382382
Split split = createMockSplit();
@@ -401,7 +401,7 @@ public void buildSplitSqlWithLimitOffset() throws SQLException {
401401
}
402402

403403
@Test
404-
public void buildSqlWithRangeAndInPredicatesTest() throws SQLException {
404+
public void buildSplitSql_WithRangeAndInPredicates_ReturnsCorrectSql() throws SQLException {
405405
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
406406
SchemaBuilder schemaBuilder = createSchemaWithCommonFields();
407407
schemaBuilder.addField(FieldBuilder.newBuilder(COL_INT, Types.MinorType.INT.getType()).build());
@@ -448,7 +448,7 @@ public void buildSqlWithRangeAndInPredicatesTest() throws SQLException {
448448
}
449449

450450
@Test
451-
public void buildSqlWithQueryPassthrough() throws SQLException {
451+
public void buildSplitSql_WithQueryPassthrough_ReturnsCorrectSql() throws SQLException {
452452
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
453453
Schema schema = createSchemaWithCommonFields().build();
454454

@@ -475,7 +475,7 @@ public void buildSqlWithQueryPassthrough() throws SQLException {
475475
}
476476

477477
@Test(expected = AthenaConnectorException.class)
478-
public void buildSqlWithInvalidQueryPassthrough() throws SQLException {
478+
public void buildSplitSql_WithInvalidQueryPassthrough_ThrowsAthenaConnectorException() throws SQLException {
479479
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
480480
SchemaBuilder schemaBuilder = createSchemaWithCommonFields();
481481
schemaBuilder.addField(FieldBuilder.newBuilder(COL_ID, Types.MinorType.INT.getType()).build());
@@ -497,7 +497,7 @@ public void buildSqlWithInvalidQueryPassthrough() throws SQLException {
497497
}
498498

499499
@Test
500-
public void buildSqlWithComplexConstraintsAndOrderBy() throws SQLException {
500+
public void buildSplitSql_WithComplexConstraintsAndOrderBy_ReturnsCorrectSql() throws SQLException {
501501
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
502502
SchemaBuilder schemaBuilder = createSchemaWithValueField();
503503
schemaBuilder.addField(FieldBuilder.newBuilder("dateCol", Types.MinorType.DATEDAY.getType()).build());
@@ -536,7 +536,7 @@ public void buildSqlWithComplexConstraintsAndOrderBy() throws SQLException {
536536
}
537537

538538
@Test
539-
public void buildSqlWithEmptyConstraintsAndOrderBy() throws SQLException {
539+
public void buildSplitSql_WithEmptyConstraintsAndOrderBy_ReturnsCorrectSql() throws SQLException {
540540
TableName tableName = new TableName(TEST_SCHEMA, TEST_TABLE);
541541
Schema schema = createSchemaWithCommonFields().build();
542542
Split split = createMockSplit();

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/resolver/SynapseJDBCCaseResolverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void setup() throws SQLException
6161
}
6262

6363
@Test
64-
public void testCaseInsensitiveCaseOnName() throws SQLException {
64+
public void getAdjustedSchemaAndTableName_WithCaseInsensitiveMode_ReturnsAdjustedNames() throws SQLException {
6565
DefaultJDBCCaseResolver resolver = new SynapseJDBCCaseResolver(SynapseConstants.NAME);
6666

6767
// Mock schema name result
@@ -90,7 +90,7 @@ public void testCaseInsensitiveCaseOnName() throws SQLException {
9090
}
9191

9292
@Test
93-
public void testCaseInsensitiveCaseOnObject() throws SQLException {
93+
public void getAdjustedTableNameObject_WithCaseInsensitiveMode_ReturnsAdjustedTableName() throws SQLException {
9494
DefaultJDBCCaseResolver resolver = new SynapseJDBCCaseResolver(SynapseConstants.NAME);
9595

9696
// Mock schema and table result sets

0 commit comments

Comments
 (0)