File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
src/test/java/com/mastercard/developer/encryption Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 11package com .mastercard .developer .encryption ;
2-
3- import org .junit .Rule ;
42import org .junit .Test ;
5- import org .junit .rules .ExpectedException ;
63
74import java .io .IOException ;
85
9- import static org .hamcrest .core .Is .isA ;
6+ import static org .junit .jupiter .api .Assertions .assertEquals ;
7+ import static org .junit .jupiter .api .Assertions .assertTrue ;
108
119public class EncryptionExceptionTest {
1210
13- @ Rule
14- public ExpectedException expectedException = ExpectedException .none ();
15-
1611 @ Test
17- public void testConstructor () throws Exception {
18-
19- expectedException .expect (EncryptionException .class );
20- expectedException .expectMessage ("Something happened!" );
21- expectedException .expectCause (isA (IOException .class ));
22-
23- throw new EncryptionException ("Something happened!" , new IOException ());
12+ public void testConstructor () {
13+ try {
14+ throw new EncryptionException ("Something happened!" , new IOException ());
15+ } catch (EncryptionException e ) {
16+ // Assert that the exception message is correct
17+ assertEquals ("Something happened!" , e .getMessage ());
18+
19+ // Assert that the cause of the exception is of type IOException
20+ assertTrue (e .getCause () instanceof IOException );
21+ }
2422 }
2523}
You can’t perform that action at this time.
0 commit comments