@Test(expected = NotEnoughChipsException.class)
 public void
     if_a_player_attempts_to_place_more_chips_on_the_table_than_available_the_system_refuses_the_bet()
         throws Exception {
   when(walletService.isAvailable(p, 10)).thenReturn(false);
   rt.placeBet(p, Field.forNumber(10), 10);
 }
 @Before
 public void setUp() {
   p = new Player();
   rng = mock(RandomNumberGenerator.class);
   walletService = mock(WalletService.class);
   timer = new TestTimer();
   rt = new RouletteTable(10000, rng, timer, walletService);
   when(walletService.isAvailable((Player) anyObject(), anyInt())).thenReturn(true);
 }
 public void placeBet(Player p, Field fields[], int value)
     throws NotEnoughChipsException, TooManyChipsException, TableFullException,
         NoMoreBetsException {
   if (currentChipsOnTable() + value > maxChipsOnTable) throw new TooManyChipsException();
   if (!players.keySet().contains(p) && players.size() == MAX_PLAYERS)
     throw new TableFullException();
   if (isBallRolling() && (timer.getTimeInMillis() - ballStartedRolling > CUT_OFF_TIME))
     throw new NoMoreBetsException();
   if (!walletService.isAvailable(p, value)) throw new NotEnoughChipsException();
   walletService.adjustBalance(p, -1 * value);
   players.put(p, Colour.values()[players.size()]);
   for (Field field : fields) {
     if (betsByFields.get(field) == null) {
       betsByFields.put(field, new ArrayList<Bet>());
     }
     betsByFields.get(field).add(new Bet(p, value, getBetType(fields)));
   }
   waitingForPlayersToComplete.add(p);
 }