### Question:
SdbCassandraInstanceDao implements CassandraInstanceDao { @Override public void delete(String ring, CassandraInstance instance) { DeleteAttributesRequest request = new DeleteAttributesRequest( domain(ring), String.valueOf(instance.getId()), buildDeleteAttributes(instance)); client.deleteAttributes(request); } @Inject  SdbCassandraInstanceDao(AmazonSimpleDBClient client, CassandraDomainFactory domainFactory); @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 delete() { CassandraInstance instance = createMock(CassandraInstance.class); Capture<DeleteAttributesRequest> requestCapture = new Capture<DeleteAttributesRequest>(); expect(domainFactory.createFromRing(RING_NAME)).andReturn(domain(RING_NAME)); expect(instance.getId()).andReturn(ID).times(2); expect(instance.getDataCenter()).andReturn(DATACENTER); expect(instance.getRack()).andReturn(RACK); expect(instance.getHostName()).andReturn(HOSTNAME); expect(instance.getPublicIpAddress()).andReturn(PUBLIC_IP_ADDRESS); expect(instance.getFullyQualifiedDomainName()).andReturn(FULLY_QUALIFIED_DOMAIN_NAME); simpleDbClient.deleteAttributes(capture(requestCapture)); replayAll(); dao.delete(RING_NAME, instance); DeleteAttributesRequest request = requestCapture.getValue(); assertEquals(DOMAIN, request.getDomainName()); assertEquals(String.valueOf(ID), request.getItemName()); assertAttributes(request); }