CommDevice { public void broadcast(MessageContents contents) { checkRegistered(); outbox.add(Message.createBroadcast(user, contents, rangePredicate)); } CommDevice(CommDeviceBuilder builder); int getReceivedCount(); int getUnreadCount(); ImmutableList<Message> getUnreadMessages(); double getReliability(); Optional<Double> getMaxRange(); void send(MessageContents contents, CommUser recipient); void broadcast(MessageContents contents); void broadcast(MessageContents contents, double range); void clearOutbox(); List<Message> getOutbox(); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void testBroadcastRangeTooLarge() { builders[0].setMaxRange(10); final CommDevice device = builders[0].build(); device.broadcast(mock(MessageContents.class), 15); }
@Test(expected = IllegalArgumentException.class) public void testBroadcastRangeNegative() { final CommDevice device = builders[0].build(); device.broadcast(mock(MessageContents.class), -1); }