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 2017/11/07 10:17:09 UTC

[sling-org-apache-sling-settings] 03/07: SLING-3818 - RunModeImplTest.testParseRunModes fails under Java 8 : Parsed runModes match for ' foo , bar '

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.settings-1.3.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 521ed2b3606ea983fc634f5c39ef7c42f43d5fc9
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Aug 4 15:54:19 2014 +0000

    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.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1615633 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/settings/impl/RunModeImplTest.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
index 658fad5..d32f5e6 100644
--- a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
@@ -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() {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.