瀏覽代碼

Final tests added

Lauren Green 6 年之前
父節點
當前提交
77f16514bf

+ 0
- 5
src/main/java/io/zipcoder/casino/test.java 查看文件

@@ -1,5 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class test {
4
-
5
-}

+ 5
- 0
src/test/java/io/zipcoder/casino/CasinoTest.java 查看文件

@@ -1,5 +1,10 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 
4
+import org.junit.Assert;
5
+import org.junit.Test;
6
+
4 7
 public class CasinoTest {
8
+
9
+
5 10
 }

+ 31
- 0
src/test/java/io/zipcoder/casino/PlayerTest.java 查看文件

@@ -0,0 +1,31 @@
1
+package io.zipcoder.casino;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class PlayerTest {
7
+
8
+    @Test
9
+    public void testInitialBalance() {
10
+        //When
11
+        Player player = new Player("Bob", 500);
12
+        int expected = 500;
13
+        int actual = player.getInitialBalance();
14
+
15
+        //Then
16
+        Assert.assertEquals(expected, actual);
17
+
18
+    }
19
+
20
+    @Test
21
+    public void testGetName() {
22
+        //When
23
+        Player player = new Player("Bob", 500);
24
+        String expected = "Bob";
25
+        String actual = player.getName();
26
+
27
+        //Then
28
+        Assert.assertEquals(expected, actual);
29
+
30
+    }
31
+}

+ 4
- 1
src/test/java/io/zipcoder/casino/ScoreSheetTest.java 查看文件

@@ -596,5 +596,8 @@ public class ScoreSheetTest {
596 596
         Assert.assertEquals(expected, actual);
597 597
 
598 598
     }
599
-        }
599
+
600
+
601
+
602
+}
600 603
 

+ 15
- 0
src/test/java/io/zipcoder/casino/YahtzeeTest.java 查看文件

@@ -267,4 +267,19 @@ public class YahtzeeTest {
267 267
         Assert.assertEquals(expected, actual);
268 268
 
269 269
     }
270
+
271
+    @Test
272
+    public void testFinalScore() {
273
+        //Given
274
+        String expected = "Your total balance is now: $" + yahtzee.getDicePlayer().getPlayer().getCurrentBalance();;
275
+
276
+        //When
277
+        String actual = yahtzee.getDicePlayer().balanceAtEnd();
278
+
279
+        //Then
280
+        Assert.assertEquals(expected, actual);
281
+
282
+    }
283
+
284
+
270 285
 }