Created
March 26, 2009 07:05
-
-
Save kitplummer/85956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.accenture.netcds.notification.event; | |
/** | |
* Created by IntelliJ IDEA. | |
* User: kplummer | |
* Date: Mar 25, 2009 | |
* Time: 1:12:18 PM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
import junit.framework.*; | |
import java.util.Set; | |
import java.util.HashSet; | |
import org.mortbay.jetty.testing.ServletTester; | |
public class EventClientTest extends TestCase { | |
private ServletTester tester; | |
private EventClient ec; | |
private String baseUrl; | |
public void setUp() throws Exception { | |
super.setUp(); | |
this.tester = new ServletTester(); | |
this.tester.setContextPath("/switchboard"); | |
this.tester.addServlet(SwitchBoardMock.class, "/event"); | |
this.baseUrl = tester.createSocketConnector(true); | |
this.tester.start(); | |
this.ec = new EventClient(); | |
this.ec.setSwitchboardUri(baseUrl + "/switchboard/event"); | |
} // setUp() | |
public void tearDown() throws Exception { | |
super.tearDown(); | |
this.tester.stop(); | |
} // tearDown() | |
public void testEventSend() throws Exception { | |
Set<String> to = new HashSet<String>(); | |
to.add("test@test.com"); | |
to.add("test2@test.com"); | |
int res = this.ec.sendEvent(to, // To | |
"tester@test.com", // From | |
"EventClient Test", // Subject | |
"test!"); // Body | |
assertEquals(200, res); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment