@@ -18,7 +18,7 @@ class LottoTicketTest {
1818 @ MethodSource ("winningNumbersSample" )
1919 public void 로또_숫자_일치_개수_비교 (List <Integer > winningNumbers , int matchCount ) throws Exception {
2020 LottoTicket lottoTicket = new LottoTicket (Arrays .asList (1 , 12 , 22 , 23 , 34 , 44 ));
21- assertThat (lottoTicket .countMatchingNumbers (new LottoTicket (winningNumbers ))).isEqualTo (PrizeMoney .toPrizeMoney (matchCount ));
21+ assertThat (lottoTicket .checkLottoTicket (new LottoTicket (winningNumbers ), 0 )).isEqualTo (Rank .toPrizeMoney (matchCount ));
2222 }
2323
2424 static Stream <Arguments > winningNumbersSample () throws Throwable {
@@ -32,4 +32,19 @@ static Stream<Arguments> winningNumbersSample() throws Throwable {
3232 );
3333 }
3434
35+ @ DisplayName ("2등 당첨 케이스를 테스트한다." )
36+ @ ParameterizedTest
37+ @ MethodSource ("secondRankSample" )
38+ public void 로또_2등_당첨 (List <Integer > numbers , List <Integer > winningNumbers , int bonusNumber ) throws Exception {
39+ LottoTicket winningTicket = new LottoTicket (winningNumbers );
40+ assertThat (new LottoTicket (numbers ).checkLottoTicket (winningTicket , bonusNumber )).isEqualTo (Rank .SECOND );
41+ }
42+
43+ static Stream <Arguments > secondRankSample () throws Throwable {
44+ return Stream .of (
45+ Arguments .of (Arrays .asList (1 , 12 , 13 , 14 , 27 , 45 ), Arrays .asList (10 , 12 , 13 , 14 , 27 , 45 ), 1 ),
46+ Arguments .of (Arrays .asList (7 , 8 , 17 , 18 , 32 , 33 ), Arrays .asList (7 , 8 , 17 , 29 , 32 , 33 ), 18 ),
47+ Arguments .of (Arrays .asList (10 , 16 , 21 , 24 , 39 , 40 ), Arrays .asList (10 , 16 , 21 , 24 , 39 , 41 ), 40 )
48+ );
49+ }
3550}
0 commit comments