|
@@ -0,0 +1,71 @@
|
|
1
|
+package com.zipcodewilmington.froilansfarm;
|
|
2
|
+
|
|
3
|
+import org.junit.Assert;
|
|
4
|
+import org.junit.Before;
|
|
5
|
+import org.junit.Test;
|
|
6
|
+import com.zipcodewilmington.froilansfarm.Holders.Farm;
|
|
7
|
+
|
|
8
|
+public class TuesdayTest {
|
|
9
|
+
|
|
10
|
+ Farm farm;
|
|
11
|
+ int cornFirstCount;
|
|
12
|
+ int tomatoFirstCount;
|
|
13
|
+ int eggFirstCount;
|
|
14
|
+
|
|
15
|
+ @Before
|
|
16
|
+ public void setup(){
|
|
17
|
+ farm = new Farm();
|
|
18
|
+ farm.populateFarm();
|
|
19
|
+ farm.morningRoutine();
|
|
20
|
+ cornFirstCount = farm.getCorn().getFoodCount();
|
|
21
|
+ tomatoFirstCount = farm.getTomato().getFoodCount();
|
|
22
|
+ eggFirstCount = farm.getEgg().getFoodCount();
|
|
23
|
+ farm.getFroilanda().setIsMounted();
|
|
24
|
+ farm.getCropDuster().fertilize(farm.getFroilanda());
|
|
25
|
+ }
|
|
26
|
+
|
|
27
|
+ @Test
|
|
28
|
+ public void isRidingTest(){
|
|
29
|
+ farm.getFroilan().setIsMounted();
|
|
30
|
+ String actual = farm.getTractor1().ride(farm.getFroilan());
|
|
31
|
+ String expected = "Driving in the field today";
|
|
32
|
+ Assert.assertEquals(expected, actual);
|
|
33
|
+ farm.getFroilanda().setIsMounted();
|
|
34
|
+ farm.getCropDuster().fertilize(farm.getFroilanda());
|
|
35
|
+ }
|
|
36
|
+
|
|
37
|
+ @Test
|
|
38
|
+ public void harvest1Test(){
|
|
39
|
+ farm.getFroilan().plant(farm.getRow1(),40);
|
|
40
|
+ farm.getFroilan().setIsMounted();
|
|
41
|
+ farm.getTractor1().ride(farm.getFroilan());
|
|
42
|
+ farm.getTractor1().collectYeild(farm.getRow1().getNumberPlanted(), farm.getCorn(), farm.getRow1());
|
|
43
|
+ int secondCount = farm.getCorn().getFoodCount();
|
|
44
|
+ int actual = secondCount - cornFirstCount;
|
|
45
|
+ int expected =40;
|
|
46
|
+ Assert.assertEquals(expected, actual);
|
|
47
|
+ }
|
|
48
|
+
|
|
49
|
+ @Test
|
|
50
|
+ public void harvest2Test(){
|
|
51
|
+ farm.getFroilan().plant(farm.getRow2(),40);
|
|
52
|
+ farm.getFroilan().setIsMounted();
|
|
53
|
+ farm.getTractor1().ride(farm.getFroilan());
|
|
54
|
+ farm.getTractor1().collectYeild(farm.getRow2().getNumberPlanted(), farm.getTomato(), farm.getRow2());
|
|
55
|
+ int secondCount = farm.getTomato().getFoodCount();
|
|
56
|
+ int actual = secondCount - tomatoFirstCount;
|
|
57
|
+ int expected =40;
|
|
58
|
+ Assert.assertEquals(expected, actual);
|
|
59
|
+ }
|
|
60
|
+ @Test
|
|
61
|
+ public void harvest3Test(){
|
|
62
|
+ farm.getFroilan().plant(farm.getRow3(),40);
|
|
63
|
+ farm.getFroilan().setIsMounted();
|
|
64
|
+ farm.getTractor1().ride(farm.getFroilan());
|
|
65
|
+ farm.getTractor1().collectYeild(farm.getRow3().getNumberPlanted(), farm.getCorn(), farm.getRow3());
|
|
66
|
+ int secondCount = farm.getCorn().getFoodCount();
|
|
67
|
+ int actual = secondCount - cornFirstCount;
|
|
68
|
+ int expected =40;
|
|
69
|
+ Assert.assertEquals(expected, actual);
|
|
70
|
+ }
|
|
71
|
+}
|