Browse Source

Total 99 - 102

Nick Satinover 6 years ago
parent
commit
e5fd9f7f8f

+ 9
- 0
src/main/java/rocks/zipcode/io/quiz3/collections/Lab.java View File

@@ -8,6 +8,7 @@ import rocks.zipcode.io.quiz3.objectorientation.enums.LabStatus;
8 8
 public class Lab {
9 9
     String labName;
10 10
     LabStatus labStatus;
11
+    boolean forked = false;
11 12
 
12 13
     public Lab() {
13 14
 
@@ -28,4 +29,12 @@ public class Lab {
28 29
     public String getName() {
29 30
         return labName;
30 31
     }
32
+
33
+    public boolean isForked() {
34
+        return forked;
35
+    }
36
+
37
+    public void setForked(boolean forked) {
38
+        this.forked = forked;
39
+    }
31 40
 }

+ 6
- 0
src/main/java/rocks/zipcode/io/quiz3/collections/Student.java View File

@@ -16,12 +16,18 @@ public class Student {
16 16
     }
17 17
 
18 18
     public void setLabStatus(Lab lab, LabStatus labStatus) {
19
+        if (lab.forked == false){
20
+            throw new UnsupportedOperationException("Method not yet implemented");
21
+        }
19 22
         map.put(lab.labName, labStatus);
20 23
 
21 24
     }
22 25
 
23 26
     public void forkLab(Lab lab) {
27
+        lab.setForked(true);
24 28
         setLabStatus(lab, LabStatus.PENDING);
29
+
30
+
25 31
     }
26 32
 
27 33
     public LabStatus getLabStatus(String labName) {

+ 1
- 0
src/test/java/rocks/zipcode/io/quiz3/collections/student/SetLabStatusOfUnforkedLab.java View File

@@ -18,6 +18,7 @@ public class SetLabStatusOfUnforkedLab {
18 18
 
19 19
         // when : setting the lab status of an unforked-lab results in UnsupportedOperationException
20 20
         student.setLabStatus(lab, expected);
21
+
21 22
     }
22 23
 
23 24
     @Test(expected = UnsupportedOperationException.class)