Search in sources :

Example 6 with AnswerPlaceholderSubtaskInfo

use of com.jetbrains.edu.learning.courseFormat.AnswerPlaceholderSubtaskInfo in project intellij-community by JetBrains.

the class StudyStepicFormatTest method doStepOptionsCreationTest.

private static StepicWrappers.StepOptions doStepOptionsCreationTest(String fileName) throws IOException {
    String responseString = FileUtil.loadFile(new File(getTestDataPath(), fileName));
    StepicWrappers.StepSource stepSource = EduStepicClient.deserializeStepicResponse(StepicWrappers.StepContainer.class, responseString).steps.get(0);
    StepicWrappers.StepOptions options = stepSource.block.options;
    List<TaskFile> files = options.files;
    assertTrue("Wrong number of task files", files.size() == 1);
    List<AnswerPlaceholder> placeholders = files.get(0).getAnswerPlaceholders();
    assertTrue("Wrong number of placeholders", placeholders.size() == 1);
    Map<Integer, AnswerPlaceholderSubtaskInfo> infos = placeholders.get(0).getSubtaskInfos();
    assertNotNull(infos);
    assertEquals(Collections.singletonList("Type your name here."), infos.get(0).getHints());
    assertEquals("Liana", infos.get(0).getPossibleAnswer());
    return options;
}
Also used : TaskFile(com.jetbrains.edu.learning.courseFormat.TaskFile) AnswerPlaceholder(com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder) AnswerPlaceholderSubtaskInfo(com.jetbrains.edu.learning.courseFormat.AnswerPlaceholderSubtaskInfo) TaskFile(com.jetbrains.edu.learning.courseFormat.TaskFile) File(java.io.File)

Aggregations

AnswerPlaceholderSubtaskInfo (com.jetbrains.edu.learning.courseFormat.AnswerPlaceholderSubtaskInfo)6 AnswerPlaceholder (com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder)4 TaskFile (com.jetbrains.edu.learning.courseFormat.TaskFile)4 Editor (com.intellij.openapi.editor.Editor)2 File (java.io.File)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 BasicUndoableAction (com.intellij.openapi.command.undo.BasicUndoableAction)1 UnexpectedUndoException (com.intellij.openapi.command.undo.UnexpectedUndoException)1 Document (com.intellij.openapi.editor.Document)1 SelectionModel (com.intellij.openapi.editor.SelectionModel)1 Project (com.intellij.openapi.project.Project)1 StudySerializationUtils (com.jetbrains.edu.learning.StudySerializationUtils)1 Test (org.junit.Test)1