16
16
package software .amazon .awssdk .codegen .customization .processors ;
17
17
18
18
19
- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
20
-
21
19
import java .io .File ;
22
- import org .junit .jupiter .api .BeforeAll ;
23
- import org .junit .jupiter .api .Test ;
20
+ import org .junit .BeforeClass ;
21
+ import org .junit .Rule ;
22
+ import org .junit .Test ;
23
+ import org .junit .rules .ExpectedException ;
24
24
import software .amazon .awssdk .codegen .C2jModels ;
25
25
import software .amazon .awssdk .codegen .IntermediateModelBuilder ;
26
26
import software .amazon .awssdk .codegen .model .config .customization .CustomizationConfig ;
@@ -36,6 +36,9 @@ public class UseLegacyEventGenerationSchemeProcessorTest {
36
36
37
37
private static final UseLegacyEventGenerationSchemeProcessor processor = new UseLegacyEventGenerationSchemeProcessor ();
38
38
39
+ @ Rule
40
+ public ExpectedException thrown = ExpectedException .none ();
41
+
39
42
private static ServiceModel serviceModel ;
40
43
41
44
@@ -49,11 +52,12 @@ public static void setup() {
49
52
50
53
@ Test
51
54
public void testPostProcess_customizationDeclaredForMultipleMembersWithSameShape_throws () {
52
- assertThatThrownBy (() -> {
53
- IntermediateModel intermediateModel = intermediateModelWithConfig ("multiple-event-types-same-shape.config" );
54
- processor .postprocess (intermediateModel );
55
- }).isInstanceOf (IllegalArgumentException .class )
56
- .hasMessageContaining ("targets more than one member with the shape" );
55
+ thrown .expect (IllegalArgumentException .class );
56
+ thrown .expectMessage ("targets more than one member with the shape" );
57
+
58
+ IntermediateModel intermediateModel = intermediateModelWithConfig ("multiple-event-types-same-shape.config" );
59
+
60
+ processor .postprocess (intermediateModel );
57
61
}
58
62
59
63
@ Test
0 commit comments