use of wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse in project prolog by woowacourse.
the class ReportStepDefinitions method 리포트가수정된다.
@Then("리포트가 수정된다")
public void 리포트가수정된다() {
int status = context.response.statusCode();
assertThat(status).isEqualTo(200);
ReportResponse reportResponse = context.response.as(ReportResponse.class);
ReportRequest reportRequest = (ReportRequest) context.storage.get("reportRequest");
ReportResponse expected = new ReportResponse(reportRequest.getId(), reportRequest.getTitle(), reportRequest.getDescription(), LocalDateTime.now(), LocalDateTime.now(), new GraphResponse(Arrays.asList(new GraphAbilityResponse(3L, "디자인", "blue", 2L, 1.0, true), new GraphAbilityResponse(1L, "프로그래밍", "red", 2L, 0.0, false))), Arrays.asList(new StudylogResponse(reportRequest.getStudylogs().get(0).getId(), LocalDateTime.now(), LocalDateTime.now(), "[자바][옵셔널] 학습log 제출합니다.", Arrays.asList(new StudylogAbilityResponse(3L, "디자인", "blue", true)))), true);
assertThat(reportResponse).usingRecursiveComparison().ignoringFields("studylogs.createAt", "studylogs.updateAt", "createdAt", "updatedAt").isEqualTo(expected);
}
use of wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse in project prolog by woowacourse.
the class ReportAssembler method of.
private StudylogResponse of(ReportedStudylog reportedStudylog) {
List<StudylogAbilityResponse> abilityResponses = reportedStudylog.getAbilities().stream().map(this::of).collect(toList());
Studylog studylog = studylogRepository.findById(reportedStudylog.getStudylogId()).orElseThrow(StudylogNotFoundException::new);
return new StudylogResponse(studylog.getId(), studylog.getCreatedAt(), studylog.getUpdatedAt(), studylog.getTitle(), abilityResponses);
}
Aggregations