GH-2760: use assertThatExceptionOfType in tests
Fixes https://github.com/spring-projects/spring-integration/issues/2760 * The `assertThatExceptionOfType()` is more convenient, than `assertThatThrownBy`, so, replace all the usages accordingly * Fix JavaDoc typo in the `AbstractScriptExecutingMessageProcessor` * Fix Sonar smells for `throws Exception` in `AbstractScriptExecutingMessageProcessor` hierarchy and some code polishing for them
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package org.springframework.integration.file.remote;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willReturn;
|
||||
import static org.mockito.BDDMockito.willThrow;
|
||||
@@ -132,14 +132,14 @@ public class StreamingInboundTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExceptionOnFetch() throws Exception {
|
||||
public void testExceptionOnFetch() {
|
||||
StringSessionFactory sessionFactory = new StringSessionFactory();
|
||||
Streamer streamer = new Streamer(new StringRemoteFileTemplate(sessionFactory), null);
|
||||
streamer.setBeanFactory(mock(BeanFactory.class));
|
||||
streamer.setRemoteDirectory("/bad");
|
||||
streamer.afterPropertiesSet();
|
||||
assertThatThrownBy(streamer::receive)
|
||||
.isInstanceOf(MessagingException.class);
|
||||
assertThatExceptionOfType(MessagingException.class)
|
||||
.isThrownBy(streamer::receive);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Reference in New Issue
Block a user