Fix tests catching nested exceptions

These tests started failing after an upstream
change in Spring Framework [1].

[1]: https://github.com/spring-projects/spring-framework/issues/25162
This commit is contained in:
Henning Poettker
2022-06-22 12:06:20 +02:00
committed by Mahmoud Ben Hassine
parent 12bd08de07
commit 451db9a968
8 changed files with 44 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021 the original author or authors.
* Copyright 2021-2022 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.
@@ -79,7 +79,7 @@ public class ChunkMessageItemWriterIntegrationTests {
@Before
public void setUp() throws Exception {
EmbeddedDatabase embeddedDatabase = new EmbeddedDatabaseBuilder()
EmbeddedDatabase embeddedDatabase = new EmbeddedDatabaseBuilder().generateUniqueName(true)
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql").build();
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(embeddedDatabase);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2022 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.
@@ -91,7 +91,7 @@ public class JobLaunchingGatewayIntegrationTests {
fail();
}
catch (MessagingException e) {
String message = e.getMessage();
String message = e.getCause().getMessage();
assertTrue("Wrong message: " + message, message.contains("replyChannel"));
}
Message<JobExecution> executionMessage = (Message<JobExecution>) responseChannel.receive(1000);

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2008-2022 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.integration.launch;
import static org.junit.Assert.assertNotNull;
@@ -57,7 +72,7 @@ public class JobLaunchingMessageHandlerIntegrationTests {
requestChannel.send(trigger);
}
catch (MessagingException e) {
String message = e.getMessage();
String message = e.getCause().getMessage();
assertTrue("Wrong message: " + message, message.contains("replyChannel"));
}
Message<JobExecution> executionMessage = (Message<JobExecution>) responseChannel.receive(1000);