use of wooteco.prolog.report.application.dto.ability.ChildAbilityDto in project prolog by woowacourse.
the class AbilityDocumentation method 상위_역량_수정시_하위_역량의_색이_모두_변경된다.
@Test
void 상위_역량_수정시_하위_역량의_색이_모두_변경된다() {
// given
AbilityResponse 생성된_상위_역량 = 상위_역량을_생성하고_response를_반환한다(accessToken, new AbilityCreateRequest("역량 이름", "역량 설명", "#000000", null));
역량을_생성한다(accessToken, new AbilityCreateRequest("하위 역량 이름", "하위 역량 설명", 생성된_상위_역량.getColor(), 생성된_상위_역량.getId()));
String 새로운_이름 = "새로운 이름";
String 새로운_설명 = "새로운 설명";
String 새로운_색상 = "#ffffff";
AbilityUpdateRequest request = new AbilityUpdateRequest(생성된_상위_역량.getId(), 새로운_이름, 새로운_설명, 새로운_색상);
// when
ExtractableResponse<Response> response = given("abilities/update-with-children-color").header(AUTHORIZATION, "Bearer " + accessToken).contentType(ContentType.JSON).body(request).when().put("/abilities/" + 생성된_상위_역량.getId()).then().log().all().extract();
// then
AbilityResponse updatedAbilityResponse = response.jsonPath().getList(".", AbilityResponse.class).stream().filter(ability -> ability.getId().equals(생성된_상위_역량.getId())).findAny().orElseThrow(AbilityNotFoundException::new);
ChildAbilityDto childAbilityResponse = updatedAbilityResponse.getChildren().get(0);
assertThat(response.statusCode()).isEqualTo(OK.value());
assertThat(updatedAbilityResponse.getId()).isEqualTo(생성된_상위_역량.getId());
assertThat(updatedAbilityResponse.getName()).isEqualTo(새로운_이름);
assertThat(updatedAbilityResponse.getDescription()).isEqualTo(새로운_설명);
assertThat(updatedAbilityResponse.getColor()).isEqualTo(새로운_색상);
assertThat(childAbilityResponse.getColor()).isEqualTo(새로운_색상);
}
Aggregations