Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 8fbf44c

Browse files
nahal99alafanechere
authored andcommitted
PgLsn New Test Case for .toString() (airbytehq#12899)
* PgLsn New Test Case for .toString() * format Co-authored-by: alafanechere <[email protected]>
1 parent 528d7d3 commit 8fbf44c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

airbyte-db/lib/src/test/java/io/airbyte/db/PgLsnTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ class PgLsnTest {
2121
.put("0/0", 0L)
2222
.build();
2323

24+
// Example Map used to run test case.
25+
private static final Map<String, Long> EXPECTED_TEST_LSNS = ImmutableMap.<String, Long>builder()
26+
.put("PgLsn{lsn=22968848}", 22968848L)
27+
.put("PgLsn{lsn=22969096}", 22969096L)
28+
.put("PgLsn{lsn=94512249608}", 94512249608L)
29+
.put("PgLsn{lsn=98784247807}", 98784247807L)
30+
.put("PgLsn{lsn=9223372036854775807}", Long.MAX_VALUE)
31+
.put("PgLsn{lsn=0}", 0L)
32+
.build();
33+
2434
@Test
2535
void testLsnToLong() {
2636
TEST_LSNS.forEach(
@@ -33,4 +43,11 @@ void testLongToLsn() {
3343
(key, value) -> assertEquals(key, PgLsn.longToLsn(value), String.format("Conversion failed. lsn: %s long value: %s", key, value)));
3444
}
3545

46+
// Added Test Case to test .toString() method in PgLsn.java
47+
@Test
48+
void testLsnToString() {
49+
EXPECTED_TEST_LSNS.forEach(
50+
(key, value) -> assertEquals(key, PgLsn.fromLong(value).toString(), String.format("Conversion failed. string: %s lsn: %s", key, value)));
51+
}
52+
3653
}

0 commit comments

Comments
 (0)