Closed hodadako closed 2 months ago
close #170
๋๋ฉ์ธ ํ ์คํธ์์ ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์๋ ๊ทธ๋ฅ @ParameterizedTest๋ฅผ ์ฐ์ง ์๋๊ฒ ๋ ์ข์๊น?
@ParameterizedTest
@ParameterizedTest(name = "{0}") @MethodSource("leagueUpdateRequestStream") @DisplayName("๋ฆฌ๊ทธ ์ ๋ณด ์์ ํ ์คํธ") void ๋ฆฌ๊ทธ_์ ๋ณด_์์ (LeagueRequestDto.Update request, List<Function<League, Executable>> assertions) throws Exception { // given League sut = new League( manager, organization, nameArbitrary().sample(), LocalDateTime.of(20, 12, 11, 0, 0, 0), LocalDateTime.of(20, 12, 12, 0, 0, 0), Round.from("8๊ฐ") ); // when sut.updateInfo(request.name(), request.startAt(), request.endAt(), Round.from(request.maxRound())); // then assertAll( assertions.stream().map(assertion -> assertion.apply(sut)) ); } private static Stream<Arguments> leagueUpdateRequestStream() { String emptyName = ""; String newName = "๋ ๋ชฌ์ฆ ์ ์ ๋ฌผ๊ณ ์ฐธ๊ธฐ ๋ํ"; LocalDateTime startAt = LocalDateTime.of(20, 12, 20, 0, 0, 0); LocalDateTime endAt = LocalDateTime.of(20, 12, 21, 0, 0, 0); String maxRound = "16๊ฐ"; return Stream.of( leagueUpdateRequestArgument( "์ด๋ฆ์ด ๋น ๊ฐ์ด ์๋ ๊ฒฝ์ฐ, ๋ํ ์ด๋ฆ, ์์ ์๊ฐ, ์ข ๋ฃ ์๊ฐ, ์ด ๋ผ์ด๋ ์๋ฅผ ์์ ํ๋ค.", new LeagueRequestDto.Update(newName, startAt, endAt, maxRound), List.of( (league) -> () -> assertThat(league.getName()).isEqualTo(newName), (league) -> () -> assertThat(league.getStartAt()).isEqualTo(startAt), (league) -> () -> assertThat(league.getEndAt()).isEqualTo(endAt), (league) -> () -> assertThat(league.getMaxRound().getDescription()).isEqualTo(maxRound) ) ), leagueUpdateRequestArgument( "์ด๋ฆ์ด ๋น ๊ฐ์ธ ๊ฒฝ์ฐ, ์ด๋ฆ์ ์ ์ธํ ์์ ์๊ฐ, ์ข ๋ฃ ์๊ฐ, ์ด ๋ผ์ด๋ ์๋ฅผ ์์ ํ๋ค.", new LeagueRequestDto.Update(emptyName, startAt, endAt, maxRound), List.of( (league) -> () -> assertThat(league.getName()).isNotEqualTo(emptyName), (league) -> () -> assertThat(league.getStartAt()).isEqualTo(startAt), (league) -> () -> assertThat(league.getEndAt()).isEqualTo(endAt), (league) -> () -> assertThat(league.getMaxRound().getDescription()).isEqualTo(maxRound) ) ) ); } private static Arguments leagueUpdateRequestArgument( final String testDisplayName, final LeagueRequestDto.Update request, final List<Function<League, Executable>> assertions) { return Arguments.of( named(testDisplayName, request), assertions ); }
๐ ์ด์ ๋ฒํธ
close #170
๐ ๊ตฌํ ๋ด์ฉ
๐ ํ์ธํด์ผ ํ ๋ถ๋ถ
๋๋ฉ์ธ ํ ์คํธ์์ ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์๋ ๊ทธ๋ฅ
@ParameterizedTest
๋ฅผ ์ฐ์ง ์๋๊ฒ ๋ ์ข์๊น?