commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1609808 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
Date Fri, 11 Jul 2014 20:26:52 GMT
Author: oheger
Date: Fri Jul 11 20:26:52 2014
New Revision: 1609808

URL: http://svn.apache.org/r1609808
Log:
Fixed a failing test case related to event listener registration.

Modified:
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java?rev=1609808&r1=1609807&r2=1609808&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
Fri Jul 11 20:26:52 2014
@@ -61,8 +61,9 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.builder.fluent.Parameters;
 import org.apache.commons.configuration.convert.DefaultListDelimiterHandler;
 import org.apache.commons.configuration.convert.ListDelimiterHandler;
-import org.apache.commons.configuration.event.ConfigurationErrorListener;
-import org.apache.commons.configuration.event.ConfigurationListener;
+import org.apache.commons.configuration.event.ConfigurationEvent;
+import org.apache.commons.configuration.event.Event;
+import org.apache.commons.configuration.event.EventListener;
 import org.apache.commons.configuration.ex.ConfigurationException;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration.interpol.Lookup;
@@ -965,23 +966,30 @@ public class TestCombinedConfigurationBu
     public void testConfigurationBuilderProviderInheritEventListeners()
             throws ConfigurationException
     {
-        ConfigurationListener cl =
-                EasyMock.createNiceMock(ConfigurationListener.class);
-        ConfigurationErrorListener el =
-                EasyMock.createNiceMock(ConfigurationErrorListener.class);
-        EasyMock.replay(cl, el);
+        @SuppressWarnings("unchecked")
+        EventListener<Event> l1 = EasyMock.createNiceMock(EventListener.class);
+        @SuppressWarnings("unchecked")
+        EventListener<ConfigurationEvent> l2 =
+                EasyMock.createNiceMock(EventListener.class);
+        EasyMock.replay(l1, l2);
         File testFile =
                 ConfigurationAssert
                         .getTestFile("testCCCombinedChildBuilder.xml");
         builder.configure(new XMLBuilderParametersImpl().setFile(testFile))
-                .addConfigurationListener(cl).addErrorListener(el);
+                .addConfigurationListener(Event.ANY, l1)
+                .addConfigurationListener(ConfigurationEvent.ANY, l2);
         CombinedConfiguration cc = builder.getConfiguration();
         CombinedConfiguration cc2 =
                 (CombinedConfiguration) cc.getConfiguration("subcc");
-        assertTrue("Configuration listener not found", cc2
-                .getConfigurationListeners().contains(cl));
-        assertTrue("Error listener not found", cc2.getErrorListeners()
-                .contains(el));
+        Collection<EventListener<? super ConfigurationEvent>> listeners =
+                cc2.getEventListeners(ConfigurationEvent.ANY);
+        assertTrue("Listener 1 not found", listeners.contains(l1));
+        assertTrue("Listener 2 not found", listeners.contains(l2));
+        Collection<EventListener<? super Event>> eventListeners =
+                cc2.getEventListeners(Event.ANY);
+        assertEquals("Wrong number of event listeners", 1,
+                eventListeners.size());
+        assertTrue("Wrong listener", eventListeners.contains(l1));
     }
 
     /**



Mime
View raw message