SharedCacheClientImpl extends SharedCacheClient { @Override public void release(ApplicationId applicationId, String resourceKey) throws YarnException { ReleaseSharedCacheResourceRequest request = Records.newRecord( ReleaseSharedCacheResourceRequest.class); request.setAppId(applicationId); request.setResourceKey(resourceKey); try { this.scmClient.release(request); } catch (Exception e) { throw new YarnException(e); } } SharedCacheClientImpl(); @Override Path use(ApplicationId applicationId, String resourceKey); @Override void release(ApplicationId applicationId, String resourceKey); @Override String getFileChecksum(Path sourceFile);  }
@Test public void testRelease() throws Exception { when(cProtocol.release(isA(ReleaseSharedCacheResourceRequest.class))) .thenReturn(null); client.release(mock(ApplicationId.class), "key"); }
@Test(expected = YarnException.class) public void testReleaseError() throws Exception { String message = "Mock IOExcepiton!"; when(cProtocol.release(isA(ReleaseSharedCacheResourceRequest.class))) .thenThrow(new IOException(message)); client.release(mock(ApplicationId.class), "key"); }