sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1615633 - /sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
Date Mon, 04 Aug 2014 15:54:19 GMT
Author: rombert
Date: Mon Aug  4 15:54:19 2014
New Revision: 1615633

URL: http://svn.apache.org/r1615633
Log:
SLING-3818 - RunModeImplTest.testParseRunModes fails under Java 8 :
Parsed runModes match for ' foo , bar '

Updated the test to no longer rely on the order of the returned run
modes.

Modified:
    sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java

Modified: sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java?rev=1615633&r1=1615632&r2=1615633&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
(original)
+++ sling/trunk/bundles/extensions/settings/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
Mon Aug  4 15:54:19 2014
@@ -18,8 +18,9 @@
  */
 package org.apache.sling.settings.impl;
 
-import static org.junit.Assert.assertArrayEquals;
+import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -27,6 +28,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -74,8 +76,13 @@ public class RunModeImplTest {
     private void assertParse(String str, String [] expected) {
         final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock(str,
null, null), new StartupHandlerImpl());
         final Set<String> modes = rm.getRunModes();
-        final String[] actual = modes.toArray(new String[modes.size()]);
-        assertArrayEquals("Parsed runModes match for '" + str + "'", expected, actual);
+
+        Set<String> expectedSet = new HashSet<String>(expected.length);
+        for (String expectedEntry : expected) {
+            expectedSet.add(expectedEntry);
+        }
+
+        assertThat("Parsed runModes match for '" + str + "'", modes, equalTo(expectedSet));
     }
 
     @org.junit.Test public void testParseRunModes() {



Mime
View raw message