use of uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction in project OpenOLAT by OpenOLAT.
the class HottextAssessmentItemBuilderTest method readHottextAssessmentItem_allCorrectAnswers.
@Test
public void readHottextAssessmentItem_allCorrectAnswers() throws URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
URL itemUrl = AssessmentItemBuilderTest.class.getResource("resources/openolat/hottext-score-all-11-4-0.xml");
AssessmentItem assessmentItem = loadAssessmentItem(itemUrl);
HottextAssessmentItemBuilder itemBuilder = new HottextAssessmentItemBuilder(assessmentItem, qtiSerializer);
// basic check ChoiceInteraction
AssessmentItem loadedItem = itemBuilder.getAssessmentItem();
List<Interaction> interactions = loadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(2, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof HottextInteraction);
Assert.assertTrue(interactions.get(1) instanceof EndAttemptInteraction);
// hot texts
Choice correct1 = itemBuilder.getChoice(Identifier.assumedLegal("htebdb40344641dba115e3c8c6ce3926"));
Assert.assertTrue(itemBuilder.isCorrect(correct1));
Choice correct2 = itemBuilder.getChoice(Identifier.assumedLegal("ht103ce53892dea97613005a5ce76be31e"));
Assert.assertTrue(itemBuilder.isCorrect(correct2));
Choice wrong1 = itemBuilder.getChoice(Identifier.assumedLegal("hte11a51c3e3d86a5f7293da19a1a8700e"));
Assert.assertFalse(itemBuilder.isCorrect(wrong1));
// score
Double maxScore = itemBuilder.getMaxScoreBuilder().getScore();
Assert.assertEquals(2.0, maxScore.doubleValue(), 0.0001);
Double minScore = itemBuilder.getMinScoreBuilder().getScore();
Assert.assertEquals(0.0, minScore.doubleValue(), 0.0001);
// per answer
Assert.assertEquals(ScoreEvaluation.allCorrectAnswers, itemBuilder.getScoreEvaluationMode());
// correct feedback
ModalFeedbackBuilder correctFeedback = itemBuilder.getCorrectFeedback();
Assert.assertNotNull(correctFeedback);
Assert.assertNotNull(correctFeedback.getText());
Assert.assertTrue(correctFeedback.getText().contains("You check the right answers"));
// incorrect
ModalFeedbackBuilder incorrectFeedback = itemBuilder.getIncorrectFeedback();
Assert.assertNotNull(incorrectFeedback);
Assert.assertNotNull(incorrectFeedback.getText());
Assert.assertTrue(incorrectFeedback.getText().contains("Some of your anwsers are not the correct one."));
// correct solution feedback
ModalFeedbackBuilder correctSolutionFeedback = itemBuilder.getCorrectSolutionFeedback();
Assert.assertNotNull(correctSolutionFeedback);
Assert.assertNotNull(correctSolutionFeedback.getText());
Assert.assertTrue(correctSolutionFeedback.getText().contains("A little hint towards the correct solution"));
// hint
ModalFeedbackBuilder hint = itemBuilder.getHint();
Assert.assertNotNull(hint);
Assert.assertNotNull(hint.getText());
Assert.assertTrue(hint.getText().contains("This is an endAttemptInteraction"));
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction in project openolat by klemens.
the class HottextAssessmentItemBuilderTest method readHottextAssessmentItem_allCorrectAnswers.
@Test
public void readHottextAssessmentItem_allCorrectAnswers() throws URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
URL itemUrl = AssessmentItemBuilderTest.class.getResource("resources/openolat/hottext-score-all-11-4-0.xml");
AssessmentItem assessmentItem = loadAssessmentItem(itemUrl);
HottextAssessmentItemBuilder itemBuilder = new HottextAssessmentItemBuilder(assessmentItem, qtiSerializer);
// basic check ChoiceInteraction
AssessmentItem loadedItem = itemBuilder.getAssessmentItem();
List<Interaction> interactions = loadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(2, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof HottextInteraction);
Assert.assertTrue(interactions.get(1) instanceof EndAttemptInteraction);
// hot texts
Choice correct1 = itemBuilder.getChoice(Identifier.assumedLegal("htebdb40344641dba115e3c8c6ce3926"));
Assert.assertTrue(itemBuilder.isCorrect(correct1));
Choice correct2 = itemBuilder.getChoice(Identifier.assumedLegal("ht103ce53892dea97613005a5ce76be31e"));
Assert.assertTrue(itemBuilder.isCorrect(correct2));
Choice wrong1 = itemBuilder.getChoice(Identifier.assumedLegal("hte11a51c3e3d86a5f7293da19a1a8700e"));
Assert.assertFalse(itemBuilder.isCorrect(wrong1));
// score
Double maxScore = itemBuilder.getMaxScoreBuilder().getScore();
Assert.assertEquals(2.0, maxScore.doubleValue(), 0.0001);
Double minScore = itemBuilder.getMinScoreBuilder().getScore();
Assert.assertEquals(0.0, minScore.doubleValue(), 0.0001);
// per answer
Assert.assertEquals(ScoreEvaluation.allCorrectAnswers, itemBuilder.getScoreEvaluationMode());
// correct feedback
ModalFeedbackBuilder correctFeedback = itemBuilder.getCorrectFeedback();
Assert.assertNotNull(correctFeedback);
Assert.assertNotNull(correctFeedback.getText());
Assert.assertTrue(correctFeedback.getText().contains("You check the right answers"));
// incorrect
ModalFeedbackBuilder incorrectFeedback = itemBuilder.getIncorrectFeedback();
Assert.assertNotNull(incorrectFeedback);
Assert.assertNotNull(incorrectFeedback.getText());
Assert.assertTrue(incorrectFeedback.getText().contains("Some of your anwsers are not the correct one."));
// correct solution feedback
ModalFeedbackBuilder correctSolutionFeedback = itemBuilder.getCorrectSolutionFeedback();
Assert.assertNotNull(correctSolutionFeedback);
Assert.assertNotNull(correctSolutionFeedback.getText());
Assert.assertTrue(correctSolutionFeedback.getText().contains("A little hint towards the correct solution"));
// hint
ModalFeedbackBuilder hint = itemBuilder.getHint();
Assert.assertNotNull(hint);
Assert.assertNotNull(hint.getText());
Assert.assertTrue(hint.getText().contains("This is an endAttemptInteraction"));
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction in project openolat by klemens.
the class MultipleChoiceAssessmentItemBuilderTest method readMultipleChoice_allAnswers_1123.
@Test
public void readMultipleChoice_allAnswers_1123() throws IOException, URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
URL itemUrl = AssessmentItemBuilderTest.class.getResource("resources/openolat/multiple-choice-score-all-11-2-3.xml");
AssessmentItem assessmentItem = loadAssessmentItem(itemUrl);
MultipleChoiceAssessmentItemBuilder itemBuilder = new MultipleChoiceAssessmentItemBuilder(assessmentItem, qtiSerializer);
// basic check ChoiceInteraction
AssessmentItem loadedItem = itemBuilder.getAssessmentItem();
List<Interaction> interactions = loadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(2, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof ChoiceInteraction);
Assert.assertTrue(interactions.get(1) instanceof EndAttemptInteraction);
// choices
SimpleChoice correct1 = itemBuilder.getChoice(Identifier.assumedLegal("mc1959a495d449f9af65b38695d3aff1"));
Assert.assertTrue(itemBuilder.isCorrect(correct1));
SimpleChoice correct2 = itemBuilder.getChoice(Identifier.assumedLegal("mca856e7adb54d3f9af06ecf9c00da69"));
Assert.assertTrue(itemBuilder.isCorrect(correct2));
SimpleChoice wrong1 = itemBuilder.getChoice(Identifier.assumedLegal("mcd39be64a6b4f20a2372cba44340e59"));
Assert.assertFalse(itemBuilder.isCorrect(wrong1));
SimpleChoice wrong2 = itemBuilder.getChoice(Identifier.assumedLegal("mc18648f96a84d479817cb5e81165c80"));
Assert.assertFalse(itemBuilder.isCorrect(wrong2));
// score
Double maxScore = itemBuilder.getMaxScoreBuilder().getScore();
Assert.assertEquals(2.0, maxScore.doubleValue(), 0.0001);
Double minScore = itemBuilder.getMinScoreBuilder().getScore();
Assert.assertEquals(0.0, minScore.doubleValue(), 0.0001);
// correct feedback
ModalFeedbackBuilder correctFeedback = itemBuilder.getCorrectFeedback();
Assert.assertNotNull(correctFeedback);
Assert.assertNotNull(correctFeedback.getText());
Assert.assertTrue(correctFeedback.getText().contains("All answers are correct"));
// incorrect
ModalFeedbackBuilder incorrectFeedback = itemBuilder.getIncorrectFeedback();
Assert.assertNotNull(incorrectFeedback);
Assert.assertNotNull(incorrectFeedback.getText());
Assert.assertTrue(incorrectFeedback.getText().contains("You missed something"));
// hint
ModalFeedbackBuilder hint = itemBuilder.getHint();
Assert.assertNotNull(hint);
Assert.assertNotNull(hint.getText());
Assert.assertTrue(hint.getText().contains("This is the correct solution"));
// per answer
Assert.assertEquals(ScoreEvaluation.allCorrectAnswers, itemBuilder.getScoreEvaluationMode());
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction in project openolat by klemens.
the class MultipleChoiceAssessmentItemBuilderTest method readMultipleChoice_allAnswers_1110.
@Test
public void readMultipleChoice_allAnswers_1110() throws IOException, URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
URL itemUrl = AssessmentItemBuilderTest.class.getResource("resources/openolat/multiple-choice-score-all-11-1-0.xml");
AssessmentItem assessmentItem = loadAssessmentItem(itemUrl);
MultipleChoiceAssessmentItemBuilder itemBuilder = new MultipleChoiceAssessmentItemBuilder(assessmentItem, qtiSerializer);
// basic check ChoiceInteraction
AssessmentItem loadedItem = itemBuilder.getAssessmentItem();
List<Interaction> interactions = loadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(2, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof ChoiceInteraction);
Assert.assertTrue(interactions.get(1) instanceof EndAttemptInteraction);
// choices
SimpleChoice correct1 = itemBuilder.getChoice(Identifier.assumedLegal("mc1959a495d449f9af65b38695d3aff1"));
Assert.assertTrue(itemBuilder.isCorrect(correct1));
SimpleChoice correct2 = itemBuilder.getChoice(Identifier.assumedLegal("mca856e7adb54d3f9af06ecf9c00da69"));
Assert.assertTrue(itemBuilder.isCorrect(correct2));
SimpleChoice wrong1 = itemBuilder.getChoice(Identifier.assumedLegal("mcd39be64a6b4f20a2372cba44340e59"));
Assert.assertFalse(itemBuilder.isCorrect(wrong1));
SimpleChoice wrong2 = itemBuilder.getChoice(Identifier.assumedLegal("mc18648f96a84d479817cb5e81165c80"));
Assert.assertFalse(itemBuilder.isCorrect(wrong2));
// score
Double maxScore = itemBuilder.getMaxScoreBuilder().getScore();
Assert.assertEquals(2.0, maxScore.doubleValue(), 0.0001);
Double minScore = itemBuilder.getMinScoreBuilder().getScore();
Assert.assertEquals(0.0, minScore.doubleValue(), 0.0001);
// correct feedback
ModalFeedbackBuilder correctFeedback = itemBuilder.getCorrectFeedback();
Assert.assertNotNull(correctFeedback);
Assert.assertNotNull(correctFeedback.getText());
Assert.assertTrue(correctFeedback.getText().contains("All answers are correct"));
// incorrect
ModalFeedbackBuilder incorrectFeedback = itemBuilder.getIncorrectFeedback();
Assert.assertNotNull(incorrectFeedback);
Assert.assertNotNull(incorrectFeedback.getText());
Assert.assertTrue(incorrectFeedback.getText().contains("You missed something"));
// hint
ModalFeedbackBuilder hint = itemBuilder.getHint();
Assert.assertNotNull(hint);
Assert.assertNotNull(hint.getText());
Assert.assertTrue(hint.getText().contains("This is the correct solution"));
// per answer
Assert.assertEquals(ScoreEvaluation.allCorrectAnswers, itemBuilder.getScoreEvaluationMode());
}
use of uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction in project OpenOLAT by OpenOLAT.
the class MultipleChoiceAssessmentItemBuilderTest method readMultipleChoice_allAnswers_1123.
@Test
public void readMultipleChoice_allAnswers_1123() throws IOException, URISyntaxException {
QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
URL itemUrl = AssessmentItemBuilderTest.class.getResource("resources/openolat/multiple-choice-score-all-11-2-3.xml");
AssessmentItem assessmentItem = loadAssessmentItem(itemUrl);
MultipleChoiceAssessmentItemBuilder itemBuilder = new MultipleChoiceAssessmentItemBuilder(assessmentItem, qtiSerializer);
// basic check ChoiceInteraction
AssessmentItem loadedItem = itemBuilder.getAssessmentItem();
List<Interaction> interactions = loadedItem.getItemBody().findInteractions();
Assert.assertNotNull(interactions);
Assert.assertEquals(2, interactions.size());
Assert.assertTrue(interactions.get(0) instanceof ChoiceInteraction);
Assert.assertTrue(interactions.get(1) instanceof EndAttemptInteraction);
// choices
SimpleChoice correct1 = itemBuilder.getChoice(Identifier.assumedLegal("mc1959a495d449f9af65b38695d3aff1"));
Assert.assertTrue(itemBuilder.isCorrect(correct1));
SimpleChoice correct2 = itemBuilder.getChoice(Identifier.assumedLegal("mca856e7adb54d3f9af06ecf9c00da69"));
Assert.assertTrue(itemBuilder.isCorrect(correct2));
SimpleChoice wrong1 = itemBuilder.getChoice(Identifier.assumedLegal("mcd39be64a6b4f20a2372cba44340e59"));
Assert.assertFalse(itemBuilder.isCorrect(wrong1));
SimpleChoice wrong2 = itemBuilder.getChoice(Identifier.assumedLegal("mc18648f96a84d479817cb5e81165c80"));
Assert.assertFalse(itemBuilder.isCorrect(wrong2));
// score
Double maxScore = itemBuilder.getMaxScoreBuilder().getScore();
Assert.assertEquals(2.0, maxScore.doubleValue(), 0.0001);
Double minScore = itemBuilder.getMinScoreBuilder().getScore();
Assert.assertEquals(0.0, minScore.doubleValue(), 0.0001);
// correct feedback
ModalFeedbackBuilder correctFeedback = itemBuilder.getCorrectFeedback();
Assert.assertNotNull(correctFeedback);
Assert.assertNotNull(correctFeedback.getText());
Assert.assertTrue(correctFeedback.getText().contains("All answers are correct"));
// incorrect
ModalFeedbackBuilder incorrectFeedback = itemBuilder.getIncorrectFeedback();
Assert.assertNotNull(incorrectFeedback);
Assert.assertNotNull(incorrectFeedback.getText());
Assert.assertTrue(incorrectFeedback.getText().contains("You missed something"));
// hint
ModalFeedbackBuilder hint = itemBuilder.getHint();
Assert.assertNotNull(hint);
Assert.assertNotNull(hint.getText());
Assert.assertTrue(hint.getText().contains("This is the correct solution"));
// per answer
Assert.assertEquals(ScoreEvaluation.allCorrectAnswers, itemBuilder.getScoreEvaluationMode());
}
Aggregations