Skip to content

Commit

Permalink
Fixed CommandLineUtilsTest for german locale (#4219)
Browse files Browse the repository at this point in the history
* Fixed CommandLineUtilsTest for german locale

* Use line number instead of error message.

* Fixed generateChangelog.test.groovy for german locale

---------

Co-authored-by: filipe <flautert@liquibase.org>
Co-authored-by: Markus KARG <karg@quipsy.de>
  • Loading branch information
3 people committed Jun 29, 2023
1 parent 75ac1c1 commit fdda73a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package liquibase.extension.testing.command

import static java.util.ResourceBundle.getBundle

import liquibase.change.ColumnConfig
import liquibase.change.ConstraintsConfig
import liquibase.change.core.AddForeignKeyConstraintChange
Expand Down Expand Up @@ -154,7 +156,7 @@ Optional Args:
cleanResources("changelog-test.xml")
}
expectedException = CommandValidationException.class
expectedExceptionMessage = "Output ChangeLogFile 'target/test-classes/changelog-test.xml' already exists!"
expectedExceptionMessage = getBundle("liquibase/i18n/liquibase-core").getString("changelogfile.already.exists").replace("%s", "target/test-classes/changelog-test.xml")
}

run "Filtering with includeObjects", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import liquibase.GlobalConfiguration
import liquibase.Scope
import spock.lang.Specification

import static java.util.ResourceBundle.getBundle

class CommandLineUtilsTest extends Specification {

private static ResourceBundle coreBundle = getBundle("liquibase/i18n/liquibase-core")

def getBanner() {
when:
String banner = Scope.child([(GlobalConfiguration.SHOW_BANNER.key): true], { ->
Expand All @@ -14,8 +18,8 @@ class CommandLineUtilsTest extends Specification {

then:
banner.contains("Get documentation at docs.liquibase.com")
banner.contains("Starting Liquibase at");
banner.contains("version ")
banner.contains(coreBundle.getString("starting.liquibase.at.timestamp").replace("%s", ""))
banner.contains(coreBundle.getString("liquibase.version.builddate").replaceFirst("%s.*", ""))
}

def "getBanner with banner disabled"() {
Expand All @@ -26,7 +30,7 @@ class CommandLineUtilsTest extends Specification {

then:
!banner.contains("Get documentation at docs.liquibase.com")
banner.contains("Starting Liquibase at");
banner.contains("version ")
banner.contains(coreBundle.getString("starting.liquibase.at.timestamp").replace("%s", ""))
banner.contains(coreBundle.getString("liquibase.version.builddate").replaceFirst("%s.*", ""))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CSVReaderTest extends Specification {

then:
def e = thrown(CsvMalformedLineException)
e.message.startsWith("Unterminated quoted field at end of CSV line")
e.lineNumber == 2

where:
separator | quote | input | notes
Expand Down

0 comments on commit fdda73a

Please sign in to comment.