### Question:
CassandraRingServiceImpl implements CassandraRingService { @Override public CassandraRing findByName(String name) { try { return dao.findByName(name); } 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 findByName() throws Exception { CassandraRing ring = createMock(CassandraRing.class); expect(dao.findByName(RING_NAME)).andReturn(ring); replayAll(); assertEquals(ring, service.findByName(RING_NAME)); }
@Test(expected = ServiceUnavailableException.class) public void findByName_backingStoreException() throws Exception { expect(dao.findByName(RING_NAME)).andThrow(new BackingStoreException()); replayAll(); service.findByName(RING_NAME); }