src/test/java/seedu/address/logic/commands/CommandTestUtil.java
public static void showFirstParcelInActiveListOnly(Model model) {
        List<ReadOnlyParcel> parcels = model.getAddressBook().getParcelList();
        Predicate<ReadOnlyParcel> predicate = (model.getActiveList().equals(model.getUncompletedParcelList()))
                ? getDeliveredPredicate().negate() : getDeliveredPredicate();

        // find the first parcel in the master list that meets the active list predicate
        Optional<ReadOnlyParcel> firstParcelOptional = parcels.stream().filter(predicate).findFirst();

        if (!firstParcelOptional.isPresent()) {
            throw new NullPointerException("No parcels in active list");
        }

        final String[] splitName = firstParcelOptional.get().getName().fullName.split("\\s+");
        model.updateFilteredParcelList(new NameContainsKeywordsPredicate(Arrays.asList(splitName[0])));

        assert model.getActiveList().size() == 1;
        assert model.getFilteredParcelList().size() == 1;
    }
/**
     * Updates {@code model}'s filtered list to show only the first parcel in the {@code model}'s address book.
     * with status not completed (Active List default state references Undelivered parcels)
     */
Updates  model's filtered list to show only the first parcel in the  model's address book.
with status not completed (Active List default state references Undelivered parcels)
Updates model ' s filtered list to show only the first parcel in the model ' s address book . with status not completed ( Active List default state references Undelivered parcels )
public static void showFirstParcelInActiveListOnly(Model model) {
        List<ReadOnlyParcel> parcels = model.getAddressBook().getParcelList();
        Predicate<ReadOnlyParcel> predicate = (model.getActiveList().equals(model.getUncompletedParcelList()))
                ? getDeliveredPredicate().negate() : getDeliveredPredicate();
        Optional<ReadOnlyParcel> firstParcelOptional = parcels.stream().filter(predicate).findFirst();
        if (!firstParcelOptional.isPresent()) {
            throw new NullPointerException("No parcels in active list");
        }
        final String[] splitName = firstParcelOptional.get().getName().fullName.split("\\s+");
        model.updateFilteredParcelList(new NameContainsKeywordsPredicate(Arrays.asList(splitName[0])));
        assert model.getActiveList().size() == 1;
        assert model.getFilteredParcelList().size() == 1;
    }
public static void showFirstParcelInActiveListOnly ( Model model ) { List < ReadOnlyParcel > parcels = model . getAddressBook ( ) . getParcelList ( ) ; Predicate < ReadOnlyParcel > predicate = ( model . getActiveList ( ) . equals ( model . getUncompletedParcelList ( ) ) ) ? getDeliveredPredicate ( ) . negate ( ) : getDeliveredPredicate ( ) ; Optional < ReadOnlyParcel > firstParcelOptional = parcels . stream ( ) . filter ( predicate ) . findFirst ( ) ; if ( ! firstParcelOptional . isPresent ( ) ) { throw new NullPointerException ( "No parcels in active list" ) ; } final String [ ] splitName = firstParcelOptional . get ( ) . getName ( ) . fullName . split ( "\\s+" ) ; model . updateFilteredParcelList ( new NameContainsKeywordsPredicate ( Arrays . asList ( splitName [ 0 ] ) ) ) ; assert model . getActiveList ( ) . size ( ) == 1 ; assert model . getFilteredParcelList ( ) . size ( ) == 1 ; }
Updates {@code model}'s filtered list to show only the first parcel in the {@code model}'s address book.
Updates { @code model } ' s filtered list to show only the first parcel in the { @code model } ' s address book .
// find the first parcel in the master list that meets the active list predicate