You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/10/16 11:13:17 UTC
svn commit: r1708927 - in /sling/trunk/bundles/commons/testing/src:
main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java
Author: rombert
Date: Fri Oct 16 09:13:17 2015
New Revision: 1708927
URL: http://svn.apache.org/viewvc?rev=1708927&view=rev
Log:
SLING-5153 - MockProperty.isMultiple returns always false
* Return the same for prop.getDefinition().isMultiple() and prop.isMultiple()
Submitted-By: Joel Richard <jo...@adobe.com>
Added:
sling/trunk/bundles/commons/testing/src/test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java
Modified:
sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java?rev=1708927&r1=1708926&r2=1708927&view=diff
==============================================================================
--- sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java (original)
+++ sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockProperty.java Fri Oct 16 09:13:17 2015
@@ -67,7 +67,7 @@ public class MockProperty implements Pro
}
public PropertyDefinition getDefinition() throws RepositoryException {
- return new MockPropertyDefinition(values.length > 1);
+ return new MockPropertyDefinition(isMultiple());
}
public double getDouble() throws ValueFormatException, RepositoryException {
@@ -267,8 +267,7 @@ public class MockProperty implements Pro
}
public boolean isMultiple() throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ return values.length > 1;
}
public void setValue(BigDecimal value) throws ValueFormatException,
Added: sling/trunk/bundles/commons/testing/src/test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java?rev=1708927&view=auto
==============================================================================
--- sling/trunk/bundles/commons/testing/src/test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java (added)
+++ sling/trunk/bundles/commons/testing/src/test/java/org/apache/sling/commons/testing/jcr/MockPropertyTest.java Fri Oct 16 09:13:17 2015
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.testing.jcr;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class MockPropertyTest {
+
+ @Test
+ public void testIsMultipleFalse() throws Exception {
+ MockProperty prop = new MockProperty("prop");
+ prop.setValue(new String[] {"val"});
+
+ assertFalse(prop.isMultiple());
+ assertFalse(prop.getDefinition().isMultiple());
+ }
+
+ @Test
+ public void testIsMultipleTrue() throws Exception {
+ MockProperty prop = new MockProperty("prop");
+ prop.setValue(new String[] {"val1", "val2"});
+
+ assertTrue(prop.isMultiple());
+ assertTrue(prop.getDefinition().isMultiple());
+ }
+
+}