use of wooteco.prolog.studylog.domain.Studylog in project prolog by woowacourse.
the class StudylogReadRepositoryTest method setUp.
@BeforeEach
void setUp() {
member = memberRepository.save(웨지);
bada = memberRepository.save(바다);
Session session = sessionRepository.save(new Session("세션1"));
Mission mission = missionRepository.save(new Mission("미션", session));
studylog = studylogRepository.save(new Studylog(member, "제목", "내용", mission, Lists.emptyList()));
}
use of wooteco.prolog.studylog.domain.Studylog in project prolog by woowacourse.
the class StudylogRepositoryTest method findTop50OrderByCreatedAtDesc.
@DisplayName("스터디로그 중 최신 50개만 조회한다.")
@Test
void findTop50OrderByCreatedAtDesc() {
// given
List<String> titles = new ArrayList<>();
for (int i = 1; i <= 100; i++) {
Studylog studylog = new Studylog(member1, String.valueOf(i), String.valueOf(i), mission1, asList(tag1, tag2));
Studylog savedStudylog = studylogRepository.save(studylog);
titles.add(savedStudylog.getTitle());
}
// when
List<Studylog> studylogs = studylogRepository.findTop50ByDeletedFalseOrderByIdDesc();
// then
assertThat(studylogs).hasSize(50);
}
use of wooteco.prolog.studylog.domain.Studylog in project prolog by woowacourse.
the class StudylogTagRepositoryTest method createStudylogTag.
@DisplayName("StudylogTag 생성")
@Test
void createStudylogTag() {
// given
Member member = memberRepository.save(웨지);
Session session = sessionRepository.save(new Session("세션1"));
Mission mission = missionRepository.save(new Mission("미션", session));
Tag tag = tagRepository.save(new Tag("태그"));
Studylog studylog = studylogRepository.save(new Studylog(member, "제목", "내용", mission, Lists.emptyList()));
// when
StudylogTag studylogTag = new StudylogTag(studylog, tag);
StudylogTag savedStudylogTag = studylogTagRepository.save(studylogTag);
// then
assertThat(savedStudylogTag.getId()).isNotNull();
assertThat(savedStudylogTag).usingRecursiveComparison().ignoringFields("id", "createdAt", "updatedAt").isEqualTo(studylogTag);
}
use of wooteco.prolog.studylog.domain.Studylog in project prolog by woowacourse.
the class AbilityStudylogResponse method of.
public static AbilityStudylogResponse of(Studylog studylog, List<StudylogAbility> studylogAbilities) {
StudylogResponse studylogResponse = StudylogResponse.of(studylog);
List<AbilityResponse> abilityResponses = studylogAbilities.stream().map(it -> AbilityResponse.of(it.getAbility())).collect(Collectors.toList());
return new AbilityStudylogResponse(studylogResponse, abilityResponses);
}
Aggregations