Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-5533

Unit test fails on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.0.0.Beta2
    • 1.9.5.Final, 2.0.0.Beta1
    • core-library
    • None

      Test method SignalBasedSnapshotChangeEventSourceTest.testBuildQueryThreePkColumns() fails because this line fails:

              Assertions.assertThat(source.buildChunkQuery(table, Optional.empty())).isEqualTo("""
                              SELECT * FROM \"s1\".\"table1\"
                              WHERE ((\"pk1\" > ?)
                              OR (\"pk1\" = ? AND \"pk2\" > ?)
                              OR (\"pk1\" = ? AND \"pk2\" = ? AND \"pk3\" > ?))
                              AND NOT ((\"pk1\" > ?) OR (\"pk1\" = ? AND \"pk2\" > ?)
                              OR (\"pk1\" = ? AND \"pk2\" = ? AND \"pk3\" > ?))
                              ORDER BY \"pk1\", \"pk2\", \"pk3\"
                              LIMIT 1024
                      """.replace(System.getProperty("line.separator"), "").replace("        ", " ").trim());

      The Java 15 Text Blocks feature is normalizing all line ending terminators to "\n" and not to the platform specific line terminator as coded above.

      So on Windows, this code

      .replace(System.getProperty("line.separator"), "")

      does nothing.

      The fix is simple:

      .replace("\n", "")

            Unassigned Unassigned
            ggaborg Gabor Andras (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: