@Test
 public void lastVerifiedAndCacheTokenApply() {
   final DateTime now = DateTime.now();
   final String cacheToken = "foo-bar";
   NestedAttributesMap attributes =
       new NestedAttributesMap(P_ATTRIBUTES, Maps.<String, Object>newHashMap());
   Asset asset = mock(Asset.class);
   when(asset.attributes()).thenReturn(attributes);
   CacheInfo cacheInfo = new CacheInfo(now, cacheToken);
   CacheInfo.applyToAsset(asset, cacheInfo);
   assertThat(
       asset.attributes().child(CacheInfo.CACHE).get(CacheInfo.LAST_VERIFIED, Date.class),
       equalTo(now.toDate()));
   assertThat(
       asset.attributes().child(CacheInfo.CACHE).get(CacheInfo.CACHE_TOKEN, String.class),
       equalTo(cacheToken));
 }
 @Test
 public void nothingToExtract() {
   NestedAttributesMap attributes =
       new NestedAttributesMap(P_ATTRIBUTES, Maps.<String, Object>newHashMap());
   Asset asset = mock(Asset.class);
   when(asset.attributes()).thenReturn(attributes);
   CacheInfo cacheInfo = CacheInfo.extractFromAsset(asset);
   assertThat(cacheInfo, nullValue());
 }
 @Test
 public void cacheTokenOnlyExtract() {
   final String cacheToken = "foo-bar";
   NestedAttributesMap attributes =
       new NestedAttributesMap(P_ATTRIBUTES, Maps.<String, Object>newHashMap());
   attributes.child(CacheInfo.CACHE).set(CacheInfo.CACHE_TOKEN, cacheToken);
   Asset asset = mock(Asset.class);
   when(asset.attributes()).thenReturn(attributes);
   CacheInfo cacheInfo = CacheInfo.extractFromAsset(asset);
   assertThat(cacheInfo, nullValue());
 }
 @Test
 public void lastVerifiedOnlyExtract() {
   final DateTime now = DateTime.now();
   NestedAttributesMap attributes =
       new NestedAttributesMap(P_ATTRIBUTES, Maps.<String, Object>newHashMap());
   attributes.child(CacheInfo.CACHE).set(CacheInfo.LAST_VERIFIED, now.toDate());
   Asset asset = mock(Asset.class);
   when(asset.attributes()).thenReturn(attributes);
   CacheInfo cacheInfo = CacheInfo.extractFromAsset(asset);
   assertThat(cacheInfo, notNullValue());
   assertThat(cacheInfo.getLastVerified(), equalTo(now));
 }