### Question:
CassandraRingServiceImpl implements CassandraRingService { @Override public ImmutableSet<CassandraRing> findAll() { try { return dao.findAll(); } catch (BackingStoreException e) { throw new ServiceUnavailableException(e); } } @Inject  CassandraRingServiceImpl(CassandraRingDao dao); @Override ImmutableSet<CassandraRing> findAll(); @Override CassandraRing findByName(String name); @Override void save(CassandraRing ring); @Override void delete(CassandraRing ring);  }### Answer:
@Test public void findAll() throws Exception { CassandraRing ring1 = createMock(CassandraRing.class); CassandraRing ring2 = createMock(CassandraRing.class); CassandraRing ring3 = createMock(CassandraRing.class); ImmutableSet<CassandraRing> rings = ImmutableSet.of(ring1, ring2, ring3); expect(dao.findAll()).andReturn(rings); replayAll(); assertEquals(rings, service.findAll()); }
@Test(expected = ServiceUnavailableException.class) public void findAll_backingStoreException() throws Exception { expect(dao.findAll()).andThrow(new BackingStoreException()); replayAll(); service.findAll(); }