diff --git a/airbyte-db/lib/src/test/java/io/airbyte/db/PgLsnTest.java b/airbyte-db/lib/src/test/java/io/airbyte/db/PgLsnTest.java index d0f80c7ddab13..3ff39239c20bc 100644 --- a/airbyte-db/lib/src/test/java/io/airbyte/db/PgLsnTest.java +++ b/airbyte-db/lib/src/test/java/io/airbyte/db/PgLsnTest.java @@ -21,6 +21,16 @@ class PgLsnTest { .put("0/0", 0L) .build(); + // Example Map used to run test case. + private static final Map EXPECTED_TEST_LSNS = ImmutableMap.builder() + .put("PgLsn{lsn=22968848}", 22968848L) + .put("PgLsn{lsn=22969096}", 22969096L) + .put("PgLsn{lsn=94512249608}", 94512249608L) + .put("PgLsn{lsn=98784247807}", 98784247807L) + .put("PgLsn{lsn=9223372036854775807}", Long.MAX_VALUE) + .put("PgLsn{lsn=0}", 0L) + .build(); + @Test void testLsnToLong() { TEST_LSNS.forEach( @@ -33,4 +43,11 @@ void testLongToLsn() { (key, value) -> assertEquals(key, PgLsn.longToLsn(value), String.format("Conversion failed. lsn: %s long value: %s", key, value))); } + // Added Test Case to test .toString() method in PgLsn.java + @Test + void testLsnToString() { + EXPECTED_TEST_LSNS.forEach( + (key, value) -> assertEquals(key, PgLsn.fromLong(value).toString(), String.format("Conversion failed. string: %s lsn: %s", key, value))); + } + }