|
16 | 16 |
|
17 | 17 | package org.springframework.integration.config.xml; |
18 | 18 |
|
19 | | -import org.junit.Test; |
| 19 | +import org.junit.jupiter.api.Test; |
20 | 20 |
|
21 | 21 | import org.springframework.beans.factory.BeanCreationException; |
22 | 22 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
23 | 23 |
|
| 24 | +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
| 25 | +import static org.assertj.core.api.Assertions.assertThatNoException; |
| 26 | + |
24 | 27 | /** |
25 | 28 | * |
26 | 29 | * @author Oleg Zhurakousky |
27 | 30 | * @author Gary Russell |
| 31 | + * @author Artem Bilan |
28 | 32 | * |
29 | 33 | */ |
30 | 34 | public class ChannelAutoCreationTests { |
31 | 35 |
|
32 | | - @Test // no assertions since it validates that no exception is thrown |
| 36 | + @Test |
33 | 37 | public void testEnablingAutoChannelCreationBeforeWithCustom() { |
34 | | - new ClassPathXmlApplicationContext("TestEnableChannelAutoCreation-before-context.xml", this.getClass()).close(); |
| 38 | + assertThatNoException() |
| 39 | + .isThrownBy(() -> |
| 40 | + new ClassPathXmlApplicationContext( |
| 41 | + "TestEnableChannelAutoCreation-before-context.xml", this.getClass())); |
35 | 42 | } |
36 | 43 |
|
37 | | - @Test // no assertions since it validates that no exception is thrown |
| 44 | + @Test |
38 | 45 | public void testEnablingAutoChannelCreationAfterWithCustom() { |
39 | | - new ClassPathXmlApplicationContext("TestEnableChannelAutoCreation-after-context.xml", this.getClass()).close(); |
| 46 | + assertThatNoException() |
| 47 | + .isThrownBy(() -> |
| 48 | + new ClassPathXmlApplicationContext( |
| 49 | + "TestEnableChannelAutoCreation-after-context.xml", this.getClass())); |
40 | 50 | } |
41 | 51 |
|
42 | | - @Test(expected = BeanCreationException.class) |
| 52 | + @Test |
43 | 53 | public void testDisablingAutoChannelCreationAfter() { |
44 | | - new ClassPathXmlApplicationContext("TestDisableChannelAutoCreation-after-context.xml", this.getClass()).close(); |
| 54 | + assertThatExceptionOfType(BeanCreationException.class) |
| 55 | + .isThrownBy(() -> |
| 56 | + new ClassPathXmlApplicationContext( |
| 57 | + "TestDisableChannelAutoCreation-after-context.xml", getClass())); |
45 | 58 | } |
46 | 59 |
|
47 | | - @Test(expected = BeanCreationException.class) |
| 60 | + @Test |
48 | 61 | public void testDisablingAutoChannelCreationBefore() { |
49 | | - new ClassPathXmlApplicationContext("TestDisableChannelAutoCreation-before-context.xml", this.getClass()) |
50 | | - .close(); |
| 62 | + assertThatExceptionOfType(BeanCreationException.class) |
| 63 | + .isThrownBy(() -> |
| 64 | + new ClassPathXmlApplicationContext( |
| 65 | + "TestDisableChannelAutoCreation-before-context.xml", this.getClass())); |
51 | 66 | } |
52 | 67 |
|
53 | 68 | } |
0 commit comments