### Question:
CacheRMConnector implements RMConnector,
    RMListener, ResourceCache.Listener { @Override public void emptyCache() throws LlamaException { List<RMResource> cachedList = cache.emptyStore(); LOG.debug("Emptying cache for queue '{}'", queue); connector.release(cachedList, true); } CacheRMConnector(Configuration conf,
      RMConnector connector); @Override void setMetricRegistry(MetricRegistry metricRegistry); @Override boolean hasResources(); @Override void deleteAllReservations(); @Override void setRMListener(RMListener listener); @Override void start(); @Override void stop(); @Override void register(String queue); @Override void unregister(); @Override List<NodeInfo> getNodes(); @Override void reserve(Collection<RMResource> resources); @Override void release(Collection<RMResource> resources, boolean doNotCache); @Override boolean reassignResource(Object rmResourceId, UUID resourceId); @Override void emptyCache(); @Override void stoppedByRM(); @Override void onEvent(List<RMEvent> events); @Override @SuppressWarnings("unchecked") void onEviction(CacheRMResource cachedRMResource);  }### Answer:
@Test public void testEmptyCache() throws Exception { RecordingMockRMConnector connector = new RecordingMockRMConnector(); CacheRMConnector cache = new CacheRMConnector( new Configuration(false), connector); cache.setRMListener(new RMListener() { @Override public void stoppedByRM() { } @Override public void onEvent(List<RMEvent> events) { } }); cache.start(); cache.getNodes(); cache.register("q"); PlacedResourceImpl pr1 = TestUtils.createPlacedResourceImpl("l1", Resource.Locality.MUST, 0, 1024); cache.reserve(Arrays.asList((RMResource) pr1)); pr1.setAllocationInfo("'l1", 0, 1024); pr1.setRmResourceId("rm1"); cache.onEvent(Arrays.asList(RMEvent.createAllocationEvent( pr1.getResourceId(), "l1", 0, 1024, "rm1", new HashMap<String, Object>()))); cache.release(Arrays.asList((RMResource) pr1), false); Assert.assertFalse(connector.getInvoked().contains("release")); cache.emptyCache(); Assert.assertTrue(connector.getInvoked().contains("release")); cache.unregister(); cache.stop(); }