Skip to content

Commit

Permalink
GH-3202: Fix tests failing with non-English locales
Browse files Browse the repository at this point in the history
Fixes #3202

Set the locale to en-US for tests that assert error messages
  • Loading branch information
grubeninspekteur authored and artembilan committed Mar 2, 2020
1 parent 8bc221b commit c6cf261
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,8 +20,11 @@
import static org.assertj.core.api.Assertions.fail;

import java.io.ByteArrayInputStream;
import java.util.Locale;
import java.util.Properties;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import org.springframework.beans.factory.config.PropertiesFactoryBean;
Expand All @@ -42,6 +45,19 @@
*/
public class ChainElementsFailureTests {

private Locale localeBeforeTest;

@Before
public void setUp() {
localeBeforeTest = Locale.getDefault();
Locale.setDefault(new Locale("en", "US"));
}

@After
public void tearDown() {
Locale.setDefault(localeBeforeTest);
}

@Test
public void chainServiceActivator() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,8 +20,11 @@
import static org.assertj.core.api.Assertions.fail;

import java.io.ByteArrayInputStream;
import java.util.Locale;
import java.util.Properties;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import org.springframework.beans.factory.config.PropertiesFactoryBean;
Expand All @@ -42,6 +45,19 @@
*/
public class ChainElementsTests {

private Locale localeBeforeTest;

@Before
public void setUp() {
localeBeforeTest = Locale.getDefault();
Locale.setDefault(new Locale("en", "US"));
}

@After
public void tearDown() {
Locale.setDefault(localeBeforeTest);
}

@Test
public void chainOutboundGateway() throws Exception {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,10 +20,13 @@
import static org.assertj.core.api.Assertions.fail;

import java.util.List;
import java.util.Locale;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.w3c.dom.Document;
Expand Down Expand Up @@ -58,6 +61,19 @@
@DirtiesContext
public class XmlPayloadValidatingFilterParserTests {

private Locale localeBeforeTest;

@Before
public void setUp() {
localeBeforeTest = Locale.getDefault();
Locale.setDefault(new Locale("en", "US"));
}

@After
public void tearDown() {
Locale.setDefault(localeBeforeTest);
}

public static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();

static {
Expand Down

0 comments on commit c6cf261

Please sign in to comment.