package edu.pdx.cs410J.grader;

import edu.pdx.cs410J.grader.ProjectTimeEstimatesSummary.TimeEstimatesSummaries;
import edu.pdx.cs410J.grader.gradebook.Assignment;
import edu.pdx.cs410J.grader.gradebook.Grade;
import edu.pdx.cs410J.grader.gradebook.GradeBook;
import edu.pdx.cs410J.grader.gradebook.Student;
import org.junit.jupiter.api.Test;

import static edu.pdx.cs410J.grader.gradebook.Assignment.ProjectType.APP_CLASSES;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class ProjectTimeEstimatesSummaryTest {

  @Test
  void oneSubmittedProjectHasSummaryWithOneSubmission() {
    GradeBook book = new GradeBook("test");
    Student student = new Student("student");
    book.addStudent(student);

    Assignment project = new Assignment("project", 1.0)
      .setProjectType(APP_CLASSES);
    book.addAssignment(project);

    Grade grade = new Grade(project, Grade.NO_GRADE);
    Grade.SubmissionInfo submission = new Grade.SubmissionInfo();
    submission.setEstimatedHours(10.0);
    grade.noteSubmission(submission);
    student.setGrade(project, grade);

    ProjectTimeEstimatesSummary summary = new ProjectTimeEstimatesSummary();
    TimeEstimatesSummaries summaries = summary.getTimeEstimateSummaries(book);
    ProjectTimeEstimatesSummary.TimeEstimatesSummary estimates = summaries.getTimeEstimateSummary(APP_CLASSES);
    assertThat(estimates.getCount(), equalTo(1));
  }
}

@@ -153,24 +153,87 @@
 Assignment;%0A
+import edu.pdx.cs410J.grader.gradebook.Assignment.ProjectType;%0A
 import edu.p
@@ -635,115 +635,459 @@
 %0A%0A  
-@Test%0A 
+private
  void 
-o
 n
+ot
 eSubmi
-ttedProjectHasSummaryWithOneSubmission() %7B%0A    GradeBook book = new GradeBook(%22test%22);
+ssion(Student student, Assignment project, double... estimates) %7B%0A    Grade grade = new Grade(project, Grade.NO_GRADE);%0A    for (double estimate : estimates) %7B%0A      Grade.SubmissionInfo submission = new Grade.SubmissionInfo();%0A      submission.setEstimatedHours(estimate);%0A      grade.noteSubmission(submission);%0A    %7D%0A    student.setGrade(project, grade);%0A  %7D%0A%0A  private Student addStudent(GradeBook book, String studentName) %7B
 %0A   
@@ -1121,17 +1121,19 @@
 ent(
-%22
 student
-%22
+Name
 );%0A 
@@ -1157,24 +1157,123 @@
 t(student);%0A
+    return student;%0A  %7D%0A%0A  private Assignment addProject(GradeBook book, ProjectType projectType) %7B
 %0A    Assignm
@@ -1339,27 +1339,27 @@
 ectType(
-APP_CLASSES
+projectType
 );%0A    b
@@ -1390,242 +1390,271 @@
 t);%0A
-%0A
     
-Grade grade = new Grade(project, Grade.NO_GRADE);%0A    Grade.SubmissionInfo submission = new Grade.SubmissionInfo(
+return project;%0A  %7D%0A%0A  @Test%0A  void oneSubmittedProjectHasSummaryWithOneSubmission() %7B%0A    GradeBook book = new GradeBook(%22test%22
 );%0A
+%0A
     
-submission.setEstimatedHours(10.0);%0A    grade.noteSubmission(submission);%0A    student.setGrade(project, grade
+ProjectType projectType = APP_CLASSES;%0A%0A    noteSubmission(addStudent(book, %22student%22), addProject(book, projectType), 10.0
 );%0A%0A
@@ -1907,27 +1907,27 @@
 Summary(
-APP_CLASSES
+projectType
 );%0A    a
@@ -1975,10 +1975,11 @@
 ));%0A  %7D%0A
+%0A
 %7D%0A

Refactor test to make future tests more concise.