sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1579457 - /sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
Date Wed, 19 Mar 2014 23:21:40 GMT
Author: cziegeler
Date: Wed Mar 19 23:21:39 2014
New Revision: 1579457

URL: http://svn.apache.org/r1579457
Log:
Fix NPE during tests

Modified:
    sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java

Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java?rev=1579457&r1=1579456&r2=1579457&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/MockedResourceResolverImplTest.java
Wed Mar 19 23:21:39 2014
@@ -36,6 +36,7 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -293,7 +294,11 @@ public class MockedResourceResolverImplT
                 resourceMetadata.put(properties[i], properties[i+1]);
                 vm.put(properties[i], properties[i+1]);
             }
+            Mockito.when(resource.getValueMap()).thenReturn(vm);
             Mockito.when(resource.adaptTo(Mockito.eq(ValueMap.class))).thenReturn(vm);
+        } else {
+            Mockito.when(resource.getValueMap()).thenReturn(ValueMapDecorator.EMPTY);
+            Mockito.when(resource.adaptTo(Mockito.eq(ValueMap.class))).thenReturn(ValueMapDecorator.EMPTY);
         }
 
         return resource;



Mime
View raw message