Skip to content

Instantly share code, notes, and snippets.

@kitplummer
Created March 26, 2009 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitplummer/85956 to your computer and use it in GitHub Desktop.
Save kitplummer/85956 to your computer and use it in GitHub Desktop.
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