public void testForEmptyClassWithAssessmentWithManyQuestionsAndReinforcements() throws Exception { // given Group group = createClass(0); Assessment a = createAssessment(group, 3, 7); // when AssessmentGradebook g = gradebookService.getForAssessment(a); // then BaseTestCase.assertEquals(3, g.getQuestionCount()); BaseTestCase.assertEquals("averages", array(0, 0, 0, 0), g.getAverages()); BaseTestCase.assertEquals(0, g.getResults().length); }
private void assertResults(AssessmentGradebook g, Integer[]... results) { StudentTopicResult[] strs = g.getResults(); assertEquals("results length", results.length, strs.length); for (int i = 0; i < results.length; ++i) { StudentTopicResult str = strs[i]; Integer[] individualResults = results[i]; for (int j = 0; j < individualResults.length - 1; j++) { AssessmentMessageResponse amr = str.getResponses()[j]; Integer answer = amr == null ? null : amr.getAnswer(); assertEquals("result #" + i, individualResults[j], answer); } assertEquals(individualResults[individualResults.length - 1].intValue(), str.getScore()); } }