From c459e7d5abd66d7bcf38e151aa2632fcb139f4f5 Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Wed, 24 Jul 2024 17:31:54 +1000 Subject: 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. --- .../markr/util/TestResultBuilder.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/test/java/com/stileeducation/markr/util/TestResultBuilder.java (limited to 'src/test/java/com/stileeducation/markr/util/TestResultBuilder.java') diff --git a/src/test/java/com/stileeducation/markr/util/TestResultBuilder.java b/src/test/java/com/stileeducation/markr/util/TestResultBuilder.java new file mode 100644 index 0000000..db26e15 --- /dev/null +++ b/src/test/java/com/stileeducation/markr/util/TestResultBuilder.java @@ -0,0 +1,36 @@ +package com.stileeducation.markr.util; + +import com.stileeducation.markr.entity.Student; +import com.stileeducation.markr.entity.Test; +import com.stileeducation.markr.entity.TestResult; + +public class TestResultBuilder { + private Long id; + private Student student; + private Test test; + private Integer marksAwarded; + + public TestResultBuilder withId(Long id) { + this.id = id; + return this; + } + + public TestResultBuilder withStudent(Student student) { + this.student = student; + return this; + } + + public TestResultBuilder withTest(Test test) { + this.test = test; + return this; + } + + public TestResultBuilder withMarksAwarded(Integer marksAwarded) { + this.marksAwarded = marksAwarded; + return this; + } + + public TestResult build() { + return new TestResult(id, student, test, marksAwarded); + } +} \ No newline at end of file -- cgit v1.2.3