Search in sources :

Example 1 with ReportPageableResponse

use of wooteco.prolog.report.application.dto.report.response.ReportPageableResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 리포트목록이조회된다.

@Then("리포트")
@Then("리포트 목록이 조회된다")
public void 리포트목록이조회된다() {
    ReportPageableResponse reportPageableResponse = context.response.as(ReportPageableResponse.class);
    assertThat(reportPageableResponse.getCurrentPage()).isOne();
    assertThat(reportPageableResponse.getTotalPage()).isOne();
    assertThat(reportPageableResponse.getTotalSize()).isOne();
    assertThat(reportPageableResponse.getReports()).hasSize(1);
}
Also used : ReportPageableResponse(wooteco.prolog.report.application.dto.report.response.ReportPageableResponse) SimpleReportPageableResponse(wooteco.prolog.report.application.dto.report.response.SimpleReportPageableResponse) Then(io.cucumber.java.en.Then)

Example 2 with ReportPageableResponse

use of wooteco.prolog.report.application.dto.report.response.ReportPageableResponse in project prolog by woowacourse.

the class ReportStepDefinitions method 대표리포트생성날짜순으로정렬되어반환된다.

@Then("대표리포트, 생성날짜 순으로 정렬되어 반환된다")
public void 대표리포트생성날짜순으로정렬되어반환된다() {
    ReportPageableResponse pageableResponse = context.response.as(new TypeRef<ReportPageableResponse>() {
    });
    List<ReportResponse> response = pageableResponse.getReports();
    List<Long> ids = response.stream().map(ReportResponse::getId).collect(toList());
    List<Long> expected = response.stream().sorted(comparing(ReportResponse::isRepresent).thenComparing(ReportResponse::getCreatedAt).reversed()).map(ReportResponse::getId).collect(toList());
    assertThat(ids).containsExactlyElementsOf(expected);
}
Also used : ReportResponse(wooteco.prolog.report.application.dto.report.response.ReportResponse) ReportPageableResponse(wooteco.prolog.report.application.dto.report.response.ReportPageableResponse) SimpleReportPageableResponse(wooteco.prolog.report.application.dto.report.response.SimpleReportPageableResponse) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)2 ReportPageableResponse (wooteco.prolog.report.application.dto.report.response.ReportPageableResponse)2 SimpleReportPageableResponse (wooteco.prolog.report.application.dto.report.response.SimpleReportPageableResponse)2 ReportResponse (wooteco.prolog.report.application.dto.report.response.ReportResponse)1