GH-3202: Fix tests failing with non-English locales
Fixes https://github.com/spring-projects/spring-integration/issues/3202 Set the locale to en-US for tests that assert error messages
This commit is contained in:
committed by
Artem Bilan
parent
8bc221b271
commit
c6cf261e25
@@ -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.
|
||||
@@ -20,8 +20,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
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;
|
||||
@@ -42,6 +45,19 @@ import org.springframework.core.io.InputStreamResource;
|
||||
*/
|
||||
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 {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -20,8 +20,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
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;
|
||||
@@ -42,6 +45,19 @@ import org.springframework.core.io.InputStreamResource;
|
||||
*/
|
||||
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 {
|
||||
|
||||
@@ -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.
|
||||
@@ -20,10 +20,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
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;
|
||||
@@ -58,6 +61,19 @@ import org.springframework.util.MultiValueMap;
|
||||
@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 {
|
||||
|
||||
Reference in New Issue
Block a user