use of wooteco.prolog.report.application.dto.report.response.ReportResponse 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.ReportResponse in project prolog by woowacourse.
the class ReportDocumentation method 레포트를업데이트한다.
@Test
void 레포트를업데이트한다() {
final ReportResponse reportResponse = 리포트조회(1L);
final ReportRequest changedReport = 리포트변경(reportResponse);
given("reports/update").contentType(ContentType.JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + 로그인(GithubResponses.티케)).body(changedReport).when().put("/reports/{reportId}", 1).then().statusCode(HttpStatus.OK.value()).extract();
}
use of wooteco.prolog.report.application.dto.report.response.ReportResponse in project prolog by woowacourse.
the class ReportServiceTest method createReport.
@Test
void createReport() throws IOException {
Member member = createMember();
setAbilities(member);
setStudylogs(member);
ReportRequest reportRequest = createRequest("jsons/report_post_request.json");
ReportResponse reportResponse = reportService.createReport(reportRequest, new LoginMember(member.getId(), Authority.MEMBER));
assertThat(reportResponse).usingRecursiveComparison().ignoringFieldsMatchingRegexes(".*id", ".*updateAt", ".*createAt", ".*createdAt", ".*updatedAt").isEqualTo(expected("jsons/report_post_response.json"));
}
use of wooteco.prolog.report.application.dto.report.response.ReportResponse 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);
}
use of wooteco.prolog.report.application.dto.report.response.ReportResponse in project prolog by woowacourse.
the class ReportServiceTest method updateReport.
@Test
void updateReport() throws IOException {
Member member = createMember();
setAbilities(member);
setStudylogs(member);
ReportRequest request = createRequest("jsons/report_post_request.json");
reportService.createReport(request, new LoginMember(member.getId(), Authority.MEMBER));
ReportRequest updateRequest = createRequest("jsons/report_put_request.json");
ReportResponse reportResponse = reportService.updateReport(1L, updateRequest, new LoginMember(member.getId(), Authority.MEMBER));
assertThat(reportResponse).usingRecursiveComparison().ignoringFieldsMatchingRegexes(".*id", ".*updateAt", ".*createAt", ".*createdAt", ".*updatedAt").isEqualTo(expected("jsons/report_put_response.json"));
}
Aggregations