Created
November 7, 2014 09:20
-
-
Save robfletcher/c5e73e43fb7f24d4f634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def "subscriber receives message"() { | |
given: "An async event bus" | |
def eventBus = new AsyncEventBus(Executors.newCachedThreadPool()) | |
and: "A Fake Service" | |
def vars = new BlockingVariables() | |
def fakeService = Stub(FictionalService) { | |
process(_) >> { PersonMessage message -> vars.message = message } | |
} | |
and: "A Subscriber" | |
def subscriber = new PersonSubscriber(eventBus, fakeService) | |
and: "A Person Message" | |
def personMessage = new PersonMessage(new Person(), PersonMessage.ACTION.CREATE) | |
when: "A message is published" | |
eventBus.post(personMessage) | |
then: "Our publisher delegates the message to our service" | |
vars.message == personMessage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment