Trip implements Serializable, Comparable<Trip>, Cloneable { public final boolean alreadyContainsItem(final Item parItem) { boolean res = false; for (Item oneItem : getListOfItems()) { if (oneItem.equals(parItem)) { res = true; break; } } return res; } Trip();  Trip(final String parName,
                final GregorianCalendar parStartDate,
                final GregorianCalendar parEndDate,
                final String parNote,
                final SortModes parSortMode); final void setNote(final String parNote); final String getNote(); final @Nullable String getName(); @SuppressWarnings("WeakerAccess") final void setName(final String parName); final GregorianCalendar getStartDate(); @SuppressWarnings("WeakerAccess") final void setStartDate(final GregorianCalendar parStartDate); final GregorianCalendar getEndDate(); @SuppressWarnings("WeakerAccess") final void setEndDate(final GregorianCalendar parEndDate); @NonNull final UUID getUUID(); final TripItem addItem(final Item parItem); final TripItem addItem(final String parName); @SuppressWarnings("WeakerAccess") final void addItem(final TripItem parItem); final int getTotalWeight(); final int getPackedWeight(); @NonNull final List<TripItem> getListOfItems(); final void deleteItem(final UUID parUUID); final void unpackAll(); final void setSortMode(final SortModes parSortMode); final SortModes getSortMode(); final boolean alreadyContainsItem(final Item parItem); final long getRemainingDays(); @Override final boolean equals(final Object parO); @Override final int hashCode(); @Override final int compareTo(@NonNull final Trip parAnotherTrip); final void packingChange(); @Override final Trip clone(); @Override final String toString();  }
@Test public void testAlreadyContainsItem() { Item item1 = new Item(); Item item2 = new Item(); Item item3 = new Item(); item1.setName(NEW_ITEM_NAME); item2.setName(NEW_ITEM2_NAME); item2.setCategory(NEW_ITEM2_CAT); item3.setName(NEW_ITEM3_NAME); item2.setCategory(NEW_ITEM3_CAT); assertFalse(mTestTrip.alreadyContainsItem(item1)); mTestTrip.addItem(item1); assertTrue(mTestTrip.alreadyContainsItem(item1)); mTestTrip.addItem(item2); mTestTrip.addItem(item3); assertTrue(mTestTrip.alreadyContainsItem(item3)); }