diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-07-24 17:31:54 +1000 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-07-24 17:31:54 +1000 |
| commit | c459e7d5abd66d7bcf38e151aa2632fcb139f4f5 (patch) | |
| tree | 2f19d20ed0cf9566eb4390f01ebf4d2be7fd6657 /src/test/java/com/stileeducation/markr/util/StudentBuilder.java | |
| parent | f08b2fa7e6a977a18d6b9f14fb73c18ec73ec5df (diff) | |
Use Apache Commons Math for calculations and implement service tests
Implement TestResultService tests and supporting entity builders.
Switch to Apache Commons Math library for descriptive statistics.
Diffstat (limited to 'src/test/java/com/stileeducation/markr/util/StudentBuilder.java')
| -rw-r--r-- | src/test/java/com/stileeducation/markr/util/StudentBuilder.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/java/com/stileeducation/markr/util/StudentBuilder.java b/src/test/java/com/stileeducation/markr/util/StudentBuilder.java new file mode 100644 index 0000000..5189f19 --- /dev/null +++ b/src/test/java/com/stileeducation/markr/util/StudentBuilder.java @@ -0,0 +1,50 @@ +package com.stileeducation.markr.util; + +import com.stileeducation.markr.entity.Student; +import com.stileeducation.markr.entity.TestResult; + +import java.util.HashSet; +import java.util.Set; + +public class StudentBuilder { + private Long id; + private String firstName; + private String lastName; + private String studentNumber; + private Set<TestResult> testResults = new HashSet<>(); + + public StudentBuilder withId(Long id) { + this.id = id; + return this; + } + + public StudentBuilder withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + public StudentBuilder withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + public StudentBuilder withStudentNumber(String studentNumber) { + this.studentNumber = studentNumber; + return this; + } + + public StudentBuilder withTestResults(Set<TestResult> testResults) { + this.testResults = testResults; + return this; + } + + public Student build() { + Student student = new Student(); + student.setId(id); + student.setFirstName(firstName); + student.setLastName(lastName); + student.setStudentNumber(studentNumber); + student.setTestResults(testResults); + return student; + } +}
\ No newline at end of file |
