simulate a pair of dice.

DiceTest.java 544B

12345678910111213141516171819202122232425262728
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. public class DiceTest
  6. {
  7. @Test
  8. public void tossTest1(){
  9. Dice die = new Dice();
  10. int min = 1;
  11. int max = 6;
  12. int actual = die.tossSum();
  13. assertTrue(min <= actual && actual <= max);
  14. }
  15. @Test
  16. public void tossTest2(){
  17. Dice die = new Dice(2);
  18. int min = 2;
  19. int max = 12;
  20. int actual = die.tossSum();
  21. assertTrue(min <= actual && actual <= max);
  22. }
  23. }