Bladeren bron

alumni test

Nuridalia.Hernandez 5 jaren geleden
bovenliggende
commit
240edeb5e0
1 gewijzigde bestanden met toevoegingen van 48 en 1 verwijderingen
  1. 48
    1
      demo/src/test/java/com/example/demo/AlumniTest.java

+ 48
- 1
demo/src/test/java/com/example/demo/AlumniTest.java Bestand weergeven

@@ -1,4 +1,51 @@
1 1
 package com.example.demo;
2 2
 
3
+import org.junit.Assert;
4
+import org.junit.Before;
5
+import org.junit.Test;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+
3 8
 public class AlumniTest {
4
-}
9
+
10
+    @Autowired
11
+    StudentConfig studentConfig;
12
+
13
+    @Autowired
14
+    InstructorsConfig instructorsConfig;
15
+
16
+
17
+    Alumni alumni;
18
+
19
+    @Before
20
+    public void setup() {
21
+        Students prevstudents = studentConfig.previousStudents();
22
+
23
+        Instructors instructors = instructorsConfig.ZipCodeInstructors();
24
+
25
+        alumni = new Alumni(instructors,prevstudents);
26
+        alumni.getPreviousCohort().add(new Student (1, "Lilith"));
27
+        alumni.getPreviousCohort().add(new Student (2, "Itchigo"));
28
+        alumni.getPreviousCohort().add(new Student (3, "Kenpachi"));
29
+        alumni.getPreviousCohort().add(new Student (4, "Rainbo Dash"));
30
+
31
+        alumni.getInstructor().add(new Instructor(1,"Leon"));
32
+        alumni.getInstructor().add(new Instructor(1,"Rengi"));
33
+
34
+    }
35
+
36
+    @Test
37
+    public void executeBootCamp(){
38
+        alumni.executeBootCamp();
39
+        double expected = 1200;
40
+
41
+        double actual = 0;
42
+
43
+        for(Student student : alumni.getPreviousCohort()) {
44
+             actual = student.getTotalStudyTime();
45
+        }
46
+
47
+        Assert.assertEquals(expected,actual, 0.0);
48
+    }
49
+
50
+
51
+}