JBoss Native SVN: r2288 - trunk/mod_cluster/src/test/java/org/jboss/modcluster/advertise.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-02-12 16:19:17 -0500 (Thu, 12 Feb 2009)
New Revision: 2288
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/advertise/AdvertiseListenerImplTestCase.java
Log:
Move AdvertiseListenerImpl construction into @Before method
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/advertise/AdvertiseListenerImplTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/advertise/AdvertiseListenerImplTestCase.java 2009-02-12 21:18:30 UTC (rev 2287)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/advertise/AdvertiseListenerImplTestCase.java 2009-02-12 21:19:17 UTC (rev 2288)
@@ -19,7 +19,6 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-
package org.jboss.modcluster.advertise;
import java.io.IOException;
@@ -39,10 +38,11 @@
import org.jboss.modcluster.config.MCMPHandlerConfiguration;
import org.jboss.modcluster.mcmp.MCMPHandler;
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
/**
- * Tests of {@link AdvertiseListenerImpl}.
+ * Tests of {@link AdvertiseListener}.
*
* @author Brian Stansberry
*/
@@ -61,7 +61,22 @@
private MulticastSocketFactory socketFactory = EasyMock.createMock(MulticastSocketFactory.class);
private MulticastSocket mcastSocket;
- private AdvertiseListenerImpl testee;
+ private AdvertiseListener listener;
+
+ @Before
+ public void setup()
+ {
+ EasyMock.expect(this.mcmpConfig.getAdvertiseGroupAddress()).andReturn(ADVERTISE_GROUP);
+ EasyMock.expect(this.mcmpConfig.getAdvertisePort()).andReturn(ADVERTISE_PORT);
+ EasyMock.expect(this.mcmpConfig.getAdvertiseSecurityKey()).andReturn(null);
+
+ EasyMock.replay(this.mcmpConfig);
+
+ this.listener = new AdvertiseListenerImpl(this.mcmpHandler, this.mcmpConfig, this.socketFactory);
+
+ EasyMock.verify(this.mcmpConfig);
+ EasyMock.reset(this.mcmpConfig);
+ }
@After
public void tearDown()
@@ -71,33 +86,22 @@
this.mcastSocket.close();
}
- if (this.testee != null)
+ if (this.listener != null)
{
- this.testee.stop();
+ this.listener.stop();
}
}
@Test
public void testBasicOperation() throws IOException
{
- EasyMock.expect(this.mcmpConfig.getAdvertiseGroupAddress()).andReturn(ADVERTISE_GROUP);
- EasyMock.expect(this.mcmpConfig.getAdvertisePort()).andReturn(ADVERTISE_PORT);
- EasyMock.expect(this.mcmpConfig.getAdvertiseSecurityKey()).andReturn(null);
-
- EasyMock.replay(this.mcmpConfig);
-
- this.testee = new AdvertiseListenerImpl(this.mcmpHandler, this.mcmpConfig, this.socketFactory);
-
- EasyMock.verify(this.mcmpConfig);
- EasyMock.reset(this.mcmpConfig);
-
Capture<InetAddress> capturedAddress = new Capture<InetAddress>();
EasyMock.expect(this.socketFactory.createMulticastSocket(EasyMock.capture(capturedAddress), EasyMock.eq(ADVERTISE_PORT))).andReturn(new MulticastSocket(ADVERTISE_PORT));
EasyMock.replay(this.socketFactory);
- this.testee.start();
+ this.listener.start();
EasyMock.verify(this.socketFactory);