@Test public void findById_ringNotFound() { expect(rings.containsKey(RING_NAME)).andStubReturn(false); expect(rings.get(RING_NAME)).andStubReturn(null); replayAll(); assertNull(dao.findById(RING_NAME, CASSANDRA_ID)); }
@Override public @Nullable CassandraInstance findById(String ring, int id) { CassandraInstance instance = null; if (rings.containsKey(ring)) { instance = rings.get(ring).get(id); } LOG.info("Returning instance: {}", instance); return instance; }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) { CassandraInstance instance = null; if (rings.containsKey(ring)) { instance = rings.get(ring).get(id); } LOG.info("Returning instance: {}", instance); return instance; } }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) { CassandraInstance instance = null; if (rings.containsKey(ring)) { instance = rings.get(ring).get(id); } LOG.info("Returning instance: {}", instance); return instance; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) { CassandraInstance instance = null; if (rings.containsKey(ring)) { instance = rings.get(ring).get(id); } LOG.info("Returning instance: {}", instance); return instance; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ringName, CassandraInstance instance); @Override void delete(String ringName, CassandraInstance instance); }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) { CassandraInstance instance = null; if (rings.containsKey(ring)) { instance = rings.get(ring).get(id); } LOG.info("Returning instance: {}", instance); return instance; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ringName, CassandraInstance instance); @Override void delete(String ringName, CassandraInstance instance);  }