### Question:
CassandraInstanceServiceImpl implements CassandraInstanceService { @Override public @Nullable CassandraInstance findById(String ring, int id) { try { return dao.findById(ring, id); } catch (BackingStoreException e) { throw new ServiceUnavailableException(e); } } @Inject  CassandraInstanceServiceImpl(CassandraInstanceDao dao); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ring, CassandraInstance instance); @Override void delete(String ring, CassandraInstance instance);  }### Answer:
@Test public void findById() throws Exception { CassandraInstance instance = createMock(CassandraInstance.class); expect(dao.findById(RING_NAME, CASSANDRA_ID)).andReturn(instance); replayAll(); assertEquals(instance, service.findById(RING_NAME, CASSANDRA_ID)); }
@Test(expected = ServiceUnavailableException.class) public void findById_backingStoreException() throws Exception { expect(dao.findById(RING_NAME, CASSANDRA_ID)).andThrow(new BackingStoreException()); replayAll(); service.findById(RING_NAME, CASSANDRA_ID); }