11package next .exception ;
22
33import static org .assertj .core .api .Assertions .assertThat ;
4+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
45
5- import org .junit .Test ;
6+ import org .junit .jupiter . api . Test ;
67
78public class PositionTest {
89 @ Test
@@ -19,29 +20,35 @@ public void create_77() {
1920 assertThat (p .getY ()).isEqualTo (7 );
2021 }
2122
22- @ Test ( expected = InValidPositionException . class )
23+ @ Test
2324 public void 길이가_2가_아닌_경우 () {
24- new Position ("a" );
25+ assertThatThrownBy (() -> new Position ("a" ))
26+ .isInstanceOf (InValidPositionException .class );
2527 }
2628
27- @ Test ( expected = InValidPositionException . class )
29+ @ Test
2830 public void notValid_0보다_작은_X () {
29- new Position ("Z1" );
31+ assertThatThrownBy (() -> new Position ("Z1" ))
32+ .isInstanceOf (InValidPositionException .class );
3033 }
3134
32- @ Test ( expected = InValidPositionException . class )
35+ @ Test
3336 public void notValid_7보다_큰_X () {
34- new Position ("i1" );
37+ assertThatThrownBy (() -> new Position ("i1" ))
38+ .isInstanceOf (InValidPositionException .class );
3539 }
3640
37- @ Test ( expected = InValidPositionException . class )
41+ @ Test
3842 public void notValid_0보다_작은_Y () {
3943 new Position ("a0" );
44+ assertThatThrownBy (() -> new Position ("a0" ))
45+ .isInstanceOf (InValidPositionException .class );
4046 }
4147
42- @ Test ( expected = InValidPositionException . class )
48+ @ Test
4349 public void notValid_7보다_큰_Y () {
44- new Position ("a9" );
50+ assertThatThrownBy (() -> new Position ("a9" ))
51+ .isInstanceOf (InValidPositionException .class );
4552 }
4653
4754}
0 commit comments