public void testWhenTerminatedWithTag() {
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");
// setup expectations
expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
.andReturn(ImmutableSet.of(nodeMetadata));
expect(nodeMetadata.getGroup()).andReturn(orgTag.getName()).atLeastOnce();
expect(nodeMetadata.getStatus()).andReturn(Status.TERMINATED).atLeastOnce();
strategy.deleteKeyPair.execute(orgTag);
expectCleanupCredentialStore(strategy, nodeMetadata);
// replay mocks