### Question:
EntryNodeWriter { public void write() throws RepositoryException, IOException { entryNode.setProperty(JCRHttpCacheStoreConstants.PN_ISCACHEENTRYNODE, true); populateMetaData(); populateHeaders(); populateBinaryContent(); if(expireTimeInMilliSeconds > 0) { setExpireTime(); } if(!entryNode.hasProperty(JCRHttpCacheStoreConstants.PN_CACHEKEY)) { populateCacheKey(); } } EntryNodeWriter(Session session, Node entryNode, CacheKey cacheKey, CacheContent cacheContent, long expireTimeInMilliSeconds, Clock clock); void write();  }### Answer:
@Test public void testValid() throws IOException, RepositoryException { final EntryNodeWriterMocks mocks = new EntryNodeWriterMocks(arguments); mocks.getEntryNodeWriter().write(); verify(mocks.getEntryNode(), times(1)) .setProperty(startsWith(JCRHttpCacheStoreConstants.PN_CACHEKEY), any(Binary.class)); final Node jcrContentNode = mocks.getJcrContentNode(); final ArgumentCaptor<Binary> argumentCaptor = ArgumentCaptor.forClass(Binary.class); verify(jcrContentNode, times(1)) .setProperty(startsWith(JcrConstants.JCR_DATA), argumentCaptor.capture()); verify(jcrContentNode, times(1)) .setProperty(JcrConstants.JCR_MIMETYPE, arguments.cacheContentType); }
@Test public void skip_setExpireTime_populateCacheKey() throws IOException, RepositoryException { when(arguments.entryNode.hasProperty(JCRHttpCacheStoreConstants.PN_CACHEKEY)).thenReturn(true); final EntryNodeWriterMocks mocks = new EntryNodeWriterMocks(arguments, 0); mocks.getEntryNodeWriter().write(); verify(mocks.getEntryNode(), times(0)) .setProperty(anyString(), any(Binary.class)); }