Package com.calclab.emite.xtesting.handlers

Examples of com.calclab.emite.xtesting.handlers.BeforeMessageSentTestHandler


  public void beforeTests() {
    eventBus = new SimpleEventBus();
    session = new XmppSessionTester();
    properties = new ChatProperties(CHAT, ME, ChatStatus.ready);
    chat = new PairChat(eventBus, session, properties);
    beforeSendHandler = new BeforeMessageSentTestHandler();
    chat.addBeforeMessageSentHandler(beforeSendHandler);
    sentHandler = new MessageSentTestHandler();
    chat.addMessageSentHandler(sentHandler);
  }
View Full Code Here


  @Test
  public void shouldInterceptOutcomingMessages() {
    // a little hack
    room.getProperties().setStatus(ChatStatus.ready);
    final BeforeMessageSentTestHandler handler = new BeforeMessageSentTestHandler();
    room.addBeforeMessageSentHandler(handler);
    room.send(new Message("body"));
    assertTrue(handler.isCalledOnce());
    assertEquals("body", handler.getLastMessage().getBody());
  }
View Full Code Here

  @Test
  public void shouldInterceptOutcomingMessages() {
    final C chat = getChat();
    chat.setStatus(ChatStatus.ready);
    final BeforeMessageSentTestHandler interceptor = new BeforeMessageSentTestHandler();
    chat.addBeforeMessageSentHandler(interceptor);
    final Message message = new Message("body");
    chat.send(message);
    assertEquals(message, interceptor.getLastMessage());
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.xtesting.handlers.BeforeMessageSentTestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.