blob: 5c513f39a2072cf6c47c17dc2717756be8c8934f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
}
}
|