@Test public void happyCase() throws Exception { // given wrap(mixinAddNote(notable1)).$$("note A", fakeData.jodaLocalDates().any(), "BLUE"); wrap(mixinAddNote(notable1)).$$("note B", fakeData.jodaLocalDates().any(), "GREEN"); wrap(mixinAddNote(notable1)).$$("note C", fakeData.jodaLocalDates().any(), "RED"); wrap(mixinAddNote(notable2)).$$("note D", fakeData.jodaLocalDates().any(), "GREEN"); final List<Note> notable1Notes = wrap(mixinNotes(notable1)).$$(); final List<Note> notable2Notes = wrap(mixinNotes(notable2)).$$(); // when final Note note1 = noteRepository.findByNotableAndCalendarName(notable1, "GREEN"); // then assertThat(note1).isNotNull(); assertThat(note1.getNotable()).isEqualTo(notable1); assertThat(notable1Notes).contains(note1); // when final Note note2 = noteRepository.findByNotableAndCalendarName(notable2, "GREEN"); // then assertThat(note2).isNotNull(); assertThat(note2.getNotable()).isEqualTo(notable2); assertThat(notable2Notes).contains(note2); }
@Test public void happyCase() throws Exception { // given wrap(mixinAddNote(notable1)).$$("note A", fakeData.jodaLocalDates().any(), "GREEN"); wrap(mixinAddNote(notable1)).$$("note B", fakeData.jodaLocalDates().any(), "BLUE"); wrap(mixinAddNote(notable2)).$$("note C", fakeData.jodaLocalDates().any(), "GREEN"); wrap(mixinAddNote(notable2)).$$("note D", fakeData.jodaLocalDates().any(), "BLUE"); final List<Note> notable2Notes = wrap(mixinNotes(notable2)).$$(); // when final List<Note> noteList = noteRepository.findByNotable(notable2); // then assertThat(noteList).hasSize(2); for (Note note : noteList) { assertThat(note.getNotable()).isEqualTo(notable2); assertThat(notable2Notes).contains(note); } }