hello guys im working on Books Library Sprint .
trying to filter by ISBN number but then when im running Junit Test the Result : ArrayList Cannot be cast to library.PickPeriod(Package Name)
would be greatfull to have some help please !
i know there is something missing after or before the filter..
public BooksReturnCode pickBook(long isbn, int readerId, LocalDate pickDate) { Book book = getBookItem(isbn); Reader reader = getReader(readerId); if(book == null) return BooksReturnCode.NO_BOOK_ITEM; if(!readers.containsKey(readerId)) return BooksReturnCode.NO_READER; if(book.getAmount()==book.getAmountInUse()) return BooksReturnCode.NO_BOOK_EXEMPLARS; List<PickRecord> pickRecords = readerRecord.getOrDefault(readerId, new ArrayList<>()); PickRecord record = (PickRecord) pickRecords.stream() .filter(d->d.getIsbn()==isbn) .collect(Collectors.toList()); if(record!=null&&record.getReturnDate()==null) return BooksReturnCode.READER_READS_IT; record = new PickRecord(isbn, readerId, pickDate); addBookRecord(record); addReaderRecord(record); addRecords(record); return BooksReturnCode.OK; }