in intellij-plugin/educational-core/testSrc/com/jetbrains/edu/learning/checker/CheckersTestBase.kt [61:87]
protected open fun checkTask(task: Task): List<AssertionError> {
UIUtil.dispatchAllInvocationEvents()
val exceptions = mutableListOf<AssertionError>()
try {
// In case of framework lessons, we can't just run checker for the given task
// because code on file system may be not updated yet.
// Launch `NextTaskAction` to make all necessary updates on file system in similar was as users do it
val frameworkLesson = task.lesson as? FrameworkLesson
val currentFrameworkLessonTask = frameworkLesson?.currentTask()
if (frameworkLesson != null && currentFrameworkLessonTask != null && currentFrameworkLessonTask != task) {
val file = currentFrameworkLessonTask.openFirstTaskFileInEditor()
launchAction(file, getActionById(NextTaskAction.ACTION_ID))
assertEquals(task, frameworkLesson.currentTask())
}
val virtualFile = task.openFirstTaskFileInEditor()
launchAction(virtualFile, CheckAction(task.getUICheckLabel()))
UIUtil.dispatchAllInvocationEvents()
} catch (e: AssertionError) {
exceptions.add(e)
} catch (e: ComparisonFailure) {
exceptions.add(e)
} catch (e: IllegalStateException) {
exceptions.add(AssertionError(e))
}
return exceptions
}