Package publisher

Source Code of publisher.PublisherTest

package publisher;

import junit.framework.TestCase;
import org.jmock.Mock;

public class PublisherTest extends TestCase {

    public void testOneSubscriberReceivesAMessage() {
        // setup
        Mock mockSubscriber = new Mock(Subscriber.class);
        Publisher publisher = new Publisher();
        publisher.add((Subscriber) mockSubscriber.proxy());

        Message message = new Message();

        // expectations
        mockSubscriber.expect("receive", message);
       
        // execute
        publisher.publish(message);
       
        // verify
        mockSubscriber.verify();
    }


}
TOP

Related Classes of publisher.PublisherTest

TOP
Copyright © 2018 www.massapi.com. 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.