You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2015/04/24 15:19:25 UTC

svn commit: r1675834 - /sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java

Author: kwin
Date: Fri Apr 24 13:19:25 2015
New Revision: 1675834

URL: http://svn.apache.org/r1675834
Log:
SLING-4658 add (ignored test case) for extraction from single elements from an underlying array

Modified:
    sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java

Modified: sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java?rev=1675834&r1=1675833&r2=1675834&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java (original)
+++ sling/trunk/bundles/api/src/test/java/org/apache/sling/api/wrappers/ValueMapDecoratorTest.java Fri Apr 24 13:19:25 2015
@@ -24,6 +24,7 @@ import java.util.Map;
 import org.apache.sling.api.resource.ValueMap;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class ValueMapDecoratorTest {
@@ -64,8 +65,26 @@ public class ValueMapDecoratorTest {
 	}
 	
 	@Test
+	@Ignore("SLING-4658")
+	public void testGettingSingleValuesFromMultiValueEntries() {
+		map.put("prop1", new String[] {"test", "test2"});
+		map.put("prop2", new String[] {"1", "2"});
+		Assert.assertEquals("First element from underlying array should be returned", "test", valueMap.get("prop1", String.class));
+		Assert.assertEquals("First element from underlying array should be returned", Integer.valueOf(1), valueMap.get("prop1", Integer.class));
+	}
+	
+	@Test
 	public void testGettingInvalidEntryWithDefaultValue() {
 		Assert.assertEquals(Integer.valueOf(1), valueMap.get("prop1", 1));
 		Assert.assertEquals("test", valueMap.get("prop1", "test"));
 	}
+	
+	@Test
+	public void testPrimitiveTypes() {
+		map.put("prop1", new String[] {"1", "2"});
+		Assert.assertNull("ValueMap should not support conversion to primitive type", valueMap.get("prop1", int.class));
+		Assert.assertNull("ValueMap should not support conversion to array of primitive type", valueMap.get("prop1", int[].class));
+	}
+	
+	
 }