### Question:
ZergCassandraRingDao implements CassandraRingDao { @Override public @Nullable CassandraRing findByName(String name) throws BackingStoreException { ZergHosts hosts = ZergHosts.from(zergConnector.getHosts()); if (!hosts.rings().contains(name)) { return null; } return buildRingFromHosts(name, hosts); } @Inject  ZergCassandraRingDao(ZergConnector zergConnector,
      @Named(ZergDaoModule.ZERG_REGION_PROPERTY) String currentRegion,
      @Named(ZergDaoModule.ZERG_CASSANDRA_RING_SCOPES) Map<String, String> ringScopes); @Override ImmutableSet<CassandraRing> findAll(); @Override @Nullable CassandraRing findByName(String name); @Override void save(CassandraRing ring); @Override void delete(CassandraRing ring);  }### Answer:
@Test public void findById() throws Exception { expect(zergConnector.getHosts()).andReturn(HOSTS); replayAll(); Iterator<CassandraRing> iterator = RINGS.iterator(); assertEquals(iterator.next(), dao.findByName(BIG_RING)); }
@Test public void findById_notFound() throws Exception { expect(zergConnector.getHosts()).andReturn(HOSTS); replayAll(); assertNull(dao.findByName("nothere")); }
@Test public void findById_emptyManifest() throws Exception { expect(zergConnector.getHosts()).andReturn(ImmutableSet.<ZergHost>of()); replayAll(); assertNull(dao.findByName(BIG_RING)); }
@Test(expected = BackingStoreException.class) public void findById_backingStoreException() throws Exception { expect(zergConnector.getHosts()).andThrow(new BackingStoreException()); replayAll(); dao.findByName(BIG_RING); }