### Question:
HopServerStatusCache implements Cache { public void put( String logId, String cacheString, int from ) { String randomPref = UUID.randomUUID().toString(); File file = null; try { file = File.createTempFile( randomPref, null ); file.deleteOnExit(); Files.write( file.toPath(), cacheString.getBytes( Const.XML_ENCODING ) ); CachedItem item = new CachedItem( file, from ); if ( ( item = cachedMap.put( logId, item ) ) != null ) { removeTask( item.getFile() ); } } catch ( Exception e ) { cachedMap.remove( logId ); if ( file != null ) { file.delete(); } } } private  HopServerStatusCache(); static synchronized HopServerStatusCache getInstance(); void put( String logId, String cacheString, int from ); byte[] get( String logId, int from ); void remove( String id ); @Override Object read( Object key ); @Override Object get( Object key ); @Override void put( Object key, Object value ); @Override void update( Object key, Object value ); @Override void remove( Object key ); @Override void clear(); @Override void destroy(); @Override Map toMap(); @Override void lock( Object key ); @Override void unlock( Object key ); @Override long nextTimestamp(); @Override int getTimeout(); @Override String getRegionName(); @Override long getSizeInMemory(); @Override long getElementCountInMemory(); @Override long getElementCountOnDisk(); static final String HOP_SERVER_STATUS_CACHE; }### Answer:
@Test public void testPut() throws Exception { initializeTestData( cache.getMap() ); String id = "40"; cacheSpy.put( "logId" + id, "test string data", 0 ); Assert.assertEquals( 41, cache.getMap().size() ); id = "20"; File mockFile = cache.getMap().get( "logId" + id ).getFile(); when( mockFile.exists() ).thenReturn( true ); cacheSpy.put( "logId" + id, "test string data", 0 ); Assert.assertEquals( 41, cache.getMap().size() ); }