Search in sources :

Example 1 with StudylogResponse

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);
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.report.response.ReportResponse) StudylogAbilityResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogAbilityResponse) GraphResponse(wooteco.prolog.report.application.dto.report.response.ability_graph.GraphResponse) ReportRequest(wooteco.prolog.report.application.dto.report.request.ReportRequest) GraphAbilityResponse(wooteco.prolog.report.application.dto.report.response.ability_graph.GraphAbilityResponse) StudylogResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse) Then(io.cucumber.java.en.Then)

Example 2 with StudylogResponse

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);
}
Also used : StudylogAbilityResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogAbilityResponse) StudylogNotFoundException(wooteco.prolog.studylog.exception.StudylogNotFoundException) StudylogResponse(wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse) ReportedStudylog(wooteco.prolog.report.domain.report.studylog.ReportedStudylog) Studylog(wooteco.prolog.studylog.domain.Studylog)

Aggregations

StudylogAbilityResponse (wooteco.prolog.report.application.dto.report.response.studylogs.StudylogAbilityResponse)2 StudylogResponse (wooteco.prolog.report.application.dto.report.response.studylogs.StudylogResponse)2 Then (io.cucumber.java.en.Then)1 ReportRequest (wooteco.prolog.report.application.dto.report.request.ReportRequest)1 ReportResponse (wooteco.prolog.report.application.dto.report.response.ReportResponse)1 GraphAbilityResponse (wooteco.prolog.report.application.dto.report.response.ability_graph.GraphAbilityResponse)1 GraphResponse (wooteco.prolog.report.application.dto.report.response.ability_graph.GraphResponse)1 ReportedStudylog (wooteco.prolog.report.domain.report.studylog.ReportedStudylog)1 Studylog (wooteco.prolog.studylog.domain.Studylog)1 StudylogNotFoundException (wooteco.prolog.studylog.exception.StudylogNotFoundException)1