-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathDiceTest.java
More file actions
42 lines (32 loc) · 838 Bytes
/
DiceTest.java
File metadata and controls
42 lines (32 loc) · 838 Bytes
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
import org.junit.Assert;
import org.junit.Test;
public class DiceTest{
@Test
public void diceConstructorTest() {
//Given
Integer expectedNumOfDie = 8;
//When
Dice dice = new Dice(expectedNumOfDie);
Integer actual = dice.getNumOfDie();
//Then
Assert.assertEquals(expectedNumOfDie, actual);
}
@Test
public void tossAndSumTwoDiceTest() {
//Given
Dice dice = new Dice(2);
//When
Integer toss = dice.tossAndSum();
//Then
Assert.assertTrue((toss > 1) && (toss < 13));
}
@Test
public void tossAndSumFiveDiceTest() {
//Given
Dice dice = new Dice(5);
//When
Integer toss = dice.tossAndSum();
//Then
Assert.assertTrue((toss > 4) && (toss < 31));
}
}