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

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

package org.jmock.example.gettingstarted;

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

public class GettingStartedJUnit3Mockomatic extends MockObjectTestCase {
    @Mock Subscriber subscriber;
    
    public void testOneSubscriberReceivesAMessage() {
        // set up
        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