Search in sources :

Example 6 with Tag

use of wooteco.prolog.studylog.domain.Tag in project prolog by woowacourse.

the class StudylogTagRepositoryTest method findByTagIn.

@DisplayName("Tag 리스트와 매칭되는 StudylogTag 리스트 조회")
@Test
void findByTagIn() {
    // given
    Member member = memberRepository.save(웨지);
    Session session = sessionRepository.save(new Session("세션1"));
    Mission mission = missionRepository.save(new Mission("미션", session));
    Studylog studylog1 = studylogRepository.save(new Studylog(member, "제목1", "내용1", mission, Lists.emptyList()));
    Studylog studylog2 = studylogRepository.save(new Studylog(member, "제목2", "내용2", mission, Lists.emptyList()));
    Tag tag1 = tagRepository.save(new Tag("태그1"));
    Tag tag2 = tagRepository.save(new Tag("태그2"));
    StudylogTag studylogTag1 = studylogTagRepository.save(new StudylogTag(studylog1, tag1));
    StudylogTag studylogTag2 = studylogTagRepository.save(new StudylogTag(studylog1, tag2));
    StudylogTag studylogTag3 = studylogTagRepository.save(new StudylogTag(studylog2, tag2));
    // when
    List<StudylogTag> studylogTags = studylogTagRepository.findByTagIn(Arrays.asList(tag1, tag2));
    // then
    assertThat(studylogTags).usingFieldByFieldElementComparator().containsExactlyInAnyOrder(studylogTag1, studylogTag2, studylogTag3);
}
Also used : Mission(wooteco.prolog.session.domain.Mission) Tag(wooteco.prolog.studylog.domain.Tag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) Member(wooteco.prolog.member.domain.Member) Studylog(wooteco.prolog.studylog.domain.Studylog) Session(wooteco.prolog.session.domain.Session) Test(org.junit.jupiter.api.Test) RepositoryTest(wooteco.support.utils.RepositoryTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 7 with Tag

use of wooteco.prolog.studylog.domain.Tag 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);
}
Also used : Mission(wooteco.prolog.session.domain.Mission) Tag(wooteco.prolog.studylog.domain.Tag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) Member(wooteco.prolog.member.domain.Member) Studylog(wooteco.prolog.studylog.domain.Studylog) Session(wooteco.prolog.session.domain.Session) Test(org.junit.jupiter.api.Test) RepositoryTest(wooteco.support.utils.RepositoryTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 8 with Tag

use of wooteco.prolog.studylog.domain.Tag in project prolog by woowacourse.

the class StudylogTagRepositoryTest method findByTagIn.

@DisplayName("Tag 리스트와 매칭되는 StudylogTag 리스트 조회")
@Test
void findByTagIn() {
    // given
    Member member = memberRepository.save(웨지);
    Session session = sessionRepository.save(new Session("세션1"));
    Mission mission = missionRepository.save(new Mission("미션", session));
    Studylog studylog1 = studylogRepository.save(new Studylog(member, "제목1", "내용1", mission, Lists.emptyList()));
    Studylog studylog2 = studylogRepository.save(new Studylog(member, "제목2", "내용2", mission, Lists.emptyList()));
    Tag tag1 = tagRepository.save(new Tag("태그1"));
    Tag tag2 = tagRepository.save(new Tag("태그2"));
    StudylogTag studylogTag1 = studylogTagRepository.save(new StudylogTag(studylog1, tag1));
    StudylogTag studylogTag2 = studylogTagRepository.save(new StudylogTag(studylog1, tag2));
    StudylogTag studylogTag3 = studylogTagRepository.save(new StudylogTag(studylog2, tag2));
    // when
    List<StudylogTag> studylogTags = studylogTagRepository.findByTagIn(Arrays.asList(tag1, tag2));
    // then
    assertThat(studylogTags).usingFieldByFieldElementComparator().containsExactlyInAnyOrder(studylogTag1, studylogTag2, studylogTag3);
}
Also used : Mission(wooteco.prolog.session.domain.Mission) Tag(wooteco.prolog.studylog.domain.Tag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) Member(wooteco.prolog.member.domain.Member) Studylog(wooteco.prolog.studylog.domain.Studylog) Session(wooteco.prolog.session.domain.Session) Test(org.junit.jupiter.api.Test) RepositoryTest(wooteco.support.utils.RepositoryTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 9 with Tag

use of wooteco.prolog.studylog.domain.Tag 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);
}
Also used : Mission(wooteco.prolog.session.domain.Mission) Tag(wooteco.prolog.studylog.domain.Tag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) StudylogTag(wooteco.prolog.studylog.domain.StudylogTag) Member(wooteco.prolog.member.domain.Member) Studylog(wooteco.prolog.studylog.domain.Studylog) Session(wooteco.prolog.session.domain.Session) Test(org.junit.jupiter.api.Test) RepositoryTest(wooteco.support.utils.RepositoryTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 10 with Tag

use of wooteco.prolog.studylog.domain.Tag in project prolog by woowacourse.

the class TagRepositoryTest method createTag.

@DisplayName("Tag 생성")
@Test
void createTag() {
    // given
    Tag tag = new Tag("나는 말하는 감자");
    // when
    Tag savedTag = tagRepository.save(tag);
    // then
    assertThat(savedTag.getId()).isNotNull();
    assertThat(savedTag).usingRecursiveComparison().ignoringFields("id", "createdAt", "updatedAt").isEqualTo(tag);
}
Also used : Tag(wooteco.prolog.studylog.domain.Tag) Test(org.junit.jupiter.api.Test) RepositoryTest(wooteco.support.utils.RepositoryTest) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

Tag (wooteco.prolog.studylog.domain.Tag)11 DisplayName (org.junit.jupiter.api.DisplayName)10 Test (org.junit.jupiter.api.Test)10 StudylogTag (wooteco.prolog.studylog.domain.StudylogTag)9 RepositoryTest (wooteco.support.utils.RepositoryTest)8 Member (wooteco.prolog.member.domain.Member)5 Mission (wooteco.prolog.session.domain.Mission)4 Session (wooteco.prolog.session.domain.Session)4 Studylog (wooteco.prolog.studylog.domain.Studylog)4 MemberTag (wooteco.prolog.member.domain.MemberTag)1 MemberTags (wooteco.prolog.member.domain.MemberTags)1