예제 #1
0
 @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());
 }
예제 #2
0
 @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));
 }