All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jmock.example.gettingstarted.GettingStartedJUnit3 Maven / Gradle / Ivy

There is a newer version: 2.13.1
Show newest version
package org.jmock.example.gettingstarted;

import org.jmock.Expectations;
import org.jmock.integration.junit3.MockObjectTestCase;

public class GettingStartedJUnit3 extends MockObjectTestCase {
    public void testOneSubscriberReceivesAMessage() {
        // set up
        final Subscriber subscriber = mock(Subscriber.class);

        Publisher publisher = new Publisher();
        publisher.add(subscriber);

        final String message = "message";

        // expectations
        checking(new Expectations() {{
            oneOf(subscriber).receive(message);
        }});

        // execute
        publisher.publish(message);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy