summaryrefslogtreecommitdiff
path: root/src/test/java/com/stileeducation/markr/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/stileeducation/markr/util')
-rw-r--r--src/test/java/com/stileeducation/markr/util/StudentBuilder.java50
-rw-r--r--src/test/java/com/stileeducation/markr/util/TestBuilder.java43
-rw-r--r--src/test/java/com/stileeducation/markr/util/TestResultBuilder.java36
3 files changed, 129 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
diff --git a/src/test/java/com/stileeducation/markr/util/TestBuilder.java b/src/test/java/com/stileeducation/markr/util/TestBuilder.java
new file mode 100644
index 0000000..5c513f3
--- /dev/null
+++ b/src/test/java/com/stileeducation/markr/util/TestBuilder.java
@@ -0,0 +1,43 @@
+package com.stileeducation.markr.util;
+
+import com.stileeducation.markr.entity.Test;
+import com.stileeducation.markr.entity.TestResult;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class TestBuilder {
+ private Long id;
+ private String testId;
+ private Integer marksAvailable;
+ private Set<TestResult> testResults = new HashSet<>();
+
+ public TestBuilder withId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public TestBuilder withTestId(String testId) {
+ this.testId = testId;
+ return this;
+ }
+
+ public TestBuilder withMarksAvailable(Integer marksAvailable) {
+ this.marksAvailable = marksAvailable;
+ return this;
+ }
+
+ public TestBuilder withTestResults(Set<TestResult> testResults) {
+ this.testResults = testResults;
+ return this;
+ }
+
+ public Test build() {
+ Test test = new Test();
+ test.setId(id);
+ test.setTestId(testId);
+ test.setMarksAvailable(marksAvailable);
+ test.setTestResults(testResults);
+ return test;
+ }
+}
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