sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1577514 - in /sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models: impl/ResourceModelClassesTest.java testmodels/classes/SimplePropertyModel.java
Date Fri, 14 Mar 2014 13:10:33 GMT
Author: justin
Date: Fri Mar 14 13:10:33 2014
New Revision: 1577514

URL: http://svn.apache.org/r1577514
Log:
adding test for array properties

Modified:
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java

Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java?rev=1577514&r1=1577513&r2=1577514&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
(original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/ResourceModelClassesTest.java
Fri Mar 14 13:10:33 2014
@@ -75,6 +75,7 @@ public class ResourceModelClassesTest {
         map.put("first", "first-value");
         map.put("third", "third-value");
         map.put("intProperty", new Integer(3));
+        map.put("arrayProperty", new String[] { "three", "four" });
         ValueMap vm = new ValueMapDecorator(map);
 
         Resource res = mock(Resource.class);
@@ -86,6 +87,11 @@ public class ResourceModelClassesTest {
         assertNull(model.getSecond());
         assertEquals("third-value", model.getThirdProperty());
         assertEquals(3, model.getIntProperty());
+
+        String[] array = model.getArrayProperty();
+        assertEquals(2, array.length);
+        assertEquals("three", array[0]);
+
         assertTrue(model.isPostConstructCalled());
     }
 
@@ -154,7 +160,7 @@ public class ResourceModelClassesTest {
 
         ParentModel model = factory.getAdapter(res, ParentModel.class);
         assertNotNull(model);
-        
+
         ChildModel childModel = model.getFirstChild();
         assertNotNull(childModel);
         assertEquals(value, childModel.getProperty());

Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java?rev=1577514&r1=1577513&r2=1577514&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java
(original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/testmodels/classes/SimplePropertyModel.java
Fri Mar 14 13:10:33 2014
@@ -41,6 +41,9 @@ public class SimplePropertyModel {
     @Inject
     private int intProperty;
 
+    @Inject
+    private String[] arrayProperty;
+
     private boolean postConstructCalled;
 
     public int getIntProperty() {
@@ -59,6 +62,10 @@ public class SimplePropertyModel {
         return thirdProperty;
     }
 
+    public String[] getArrayProperty() {
+        return arrayProperty;
+    }
+
     @PostConstruct
     protected void postConstruct() {
         postConstructCalled = true;



Mime
View raw message