@Override public Fruit getRandomFruit() { int id = new Random().nextInt(14); return dao.getFruitById(id); } }
@Test(expected = IndexOutOfBoundsException.class) public void whenIdWrongThrowException() { dao.getFruitById(-1); } }
@Test public void whenIdCorrectGetFruitById() { assertNotNull(dao.getFruitById(id)); }