use of com.eventyay.organizer.data.attendee.Attendee in project open-event-orga-app by fossasia.
the class UtilsTest method shouldFindIndex.
@Test
public void shouldFindIndex() {
List<Attendee> attendees = Arrays.asList(Attendee.builder().id(12).build(), Attendee.builder().id(34).build(), Attendee.builder().id(10).build(), Attendee.builder().id(90).build(), Attendee.builder().id(3).build());
Attendee newAttendee = Attendee.builder().id(10).build();
Utils.PropertyMatcher<Attendee> idEqual = (first, second) -> first.getId() == second.getId();
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(2);
newAttendee.setId(12);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(0);
newAttendee.setId(3);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(4);
newAttendee.setId(2);
Utils.indexOf(attendees, newAttendee, idEqual).test().assertNoErrors().assertValue(-1);
}
Aggregations