示例#1
0
 @Test
 public void answerCorrectlyButNotSoonEnough() {
   g.setAnswerTime(-1);
   g.take(P1);
   g.answer(true);
   assertEquals(-200, g.scoreFor(P1));
 }
示例#2
0
 @Test
 public void readQuestionSometimeTriesToAnswerButIsIncorrect() {
   g.take(P2);
   g.answer(false);
   assertEquals(-200, g.scoreFor(P2));
   assertEquals(0, g.scoreFor(P1));
 }
示例#3
0
 @Test(expected = NoCurrentPlayerException.class)
 public void takeAnswerWrongAnswerCorrectlyWithoutTakingScoresSafe() {
   g.take(P1);
   g.answer(false);
   assertEquals(-200, g.scoreFor(P1));
   g.answer(false);
 }
示例#4
0
 @Test
 public void readQuestionSomoneTriesToAnswerAndDoes() {
   g.take(P1);
   g.answer(true);
   assertEquals(200, g.scoreFor(P1));
   assertEquals(0, g.scoreFor(P2));
   assertTrue(g.retrieve("C", 200).isUsed());
 }
示例#5
0
 @Test
 public void readQuestionSomeoneTriesToAnswerDoesNotSomeoneElseAnswersIncorrectly() {
   g.take(P1);
   g.answer(false);
   g.take(P2);
   g.answer(false);
   assertEquals(-200, g.scoreFor(P1));
   assertEquals(-200, g.scoreFor(P2));
 }
示例#6
0
 @SuppressWarnings("serial")
 @Before
 public void createBoardAndGame() throws FileNotFoundException {
   b = new Board();
   b.add("C", 200, "A", "Q");
   g = new Game();
   g.setOutputStream(new PrintStream(new ByteArrayOutputStream()));
   g.setBoard(b);
   g.setAnswerTime(1);
   g.addPlayer(P1);
   g.addPlayer(P2);
   g.start();
   g.select("C", 200);
 }
示例#7
0
 @Test
 public void readQuestionNobodyTriesToAnswer() {
   g.noAnswer();
 }
示例#8
0
 @Test(expected = AnswerQuestionCurrentlySelectedException.class)
 public void selectAnswerWhenOneAlreadySelected() {
   g.select("C", 400);
 }
示例#9
0
 @Test
 public void attemptToTakeWhenAlreadyTakenBySelf() {
   g.take(P1);
   g.take(P1);
 }
示例#10
0
 @Test(expected = AlreadyTakeException.class)
 public void attemptToTakeWhenAlreadyTakenByAnother() {
   g.take(P1);
   g.take(P2);
 }