Quiz { public boolean checkAnswers(Long... answersIDs) { boolean correct = answersIDs != null && answersIDs.length > 0; if (correct) { final List<Answer> correctAnswers = this.getAnswers().filtered(Answer::isCorrect); correct = correctAnswers.size() == answersIDs.length; if (correct) { final List<Long> answersIDsList = Arrays.asList(answersIDs); int index = 0; int numberOfCorrectAnswersReceived = 0; while (index < correctAnswers.size() && correct) { correct = answersIDsList.contains(correctAnswers.get(index).getId()); if (correct) numberOfCorrectAnswersReceived++; index++; } correct = numberOfCorrectAnswersReceived == correctAnswers.size(); } } return correct; }  LongProperty idProperty(); long getId(); void setId(long id); Question getQuestion(); ObjectProperty<Question> questionProperty(); void setQuestion(Question question); ListProperty<Answer> answersProperty(); ObservableList<Answer> getAnswers(); void setAnswers(ObservableList<Answer> answers); FilteredList<Answer> getCorrectAnswers(); boolean checkAnswers(Long... answersIDs); JsonObject toJSON(); String toJSONString(); static Quiz build(final String json);  }
@Test public void testWithoutAnswers() { assertFalse(quiz.checkAnswers()); }
@Test public void testWithFalseAnswer() { assertFalse(quiz.checkAnswers(1L)); }
@Test public void testWithoutAllCorrectAnswers() { assertFalse(quiz.checkAnswers(2L)); }
@Test public void testWithAllCorrectAnswersAndAWrongAnswer() { assertFalse(quiz.checkAnswers(1L, 2L, 3L)); }
@Test public void testWithCorrectAnswers() { assertTrue(quiz.checkAnswers(2L, 3L)); }