Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ladislav Sulak <laco.sulak@gmail.com>
  • Loading branch information
benedeki and lsulak authored Aug 19, 2024
1 parent 34989d3 commit 8a01dae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_filenames_check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2021 ABSA Group Limited
# Copyright 2023 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ object QueryResultRow {
new QueryResultRow(resultSet.getRow, fields, fieldNames)
}

def fieldNamesFromMetdata(metaData: ResultSetMetaData): FieldNames = {
def fieldNamesFromMetadata(metaData: ResultSetMetaData): FieldNames = {
Range.inclusive(1, metaData.getColumnCount).map(i => metaData.getColumnName(i) -> i).toMap
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import java.sql.ResultSetMetaData
import Postgres.PostgresRow
import za.co.absa.db.balta.classes.simple.SimpleJsonString

class PostgresRowIntegrationTests extends AnyFunSuiteLike with DBTestingConnection{
class PostgresRowIntegrationTests extends AnyFunSuiteLike with DBTestingConnection{
private val (tableRows: List[QueryResultRow], metadata: ResultSetMetaData) = DBTable("testing.pg_types").all("id") { q =>
(q.toList, q.resultSetMetaData)
}

test("fieldNamesFromMetada") {
val result = QueryResultRow.fieldNamesFromMetdata(metadata)

val expecedResult = Seq(
val expectedResult = Seq(
"id",
"json_type",
"jsonb_type",
Expand All @@ -42,7 +42,7 @@ class PostgresRowIntegrationTests extends AnyFunSuiteLike with DBTestingConnect
.map(x => (x._1, x._2 + 1))
.toMap
assert(result.size == 4)
assert(result == expecedResult)
assert(result == expectedResult)
}

test("getSimpleJson") {
Expand All @@ -68,7 +68,7 @@ class PostgresRowIntegrationTests extends AnyFunSuiteLike with DBTestingConnect
SimpleJsonString("""{"a": 3, "body": ""}"""),
SimpleJsonString("""{"a": 4}""")
)
assert(tableRows.head.getSJSArray(4).get == (expected))
assert(tableRows.head.getSJSArray(4).get == expected)
assert(tableRows.head.getSJSArray("array_of_json_type").contains(expected))
//second row
val secondRow = tableRows.tail.head
Expand Down

0 comments on commit 8a01dae

Please sign in to comment.