JMock is a library that supports test-driven development of Java code with mock objects. To test interactions between the Publisher and the Subscriber we will use a mock Subscriber object. States are used to specify that invocations can occur only during some state that is initiated and/or terminated by other expected invocations. jMock is a library which helps to create test-driven development of Java code with mock objects. JMock focuses on explicitly specifying the behavior of the mocks using a specialized DSL (Domain-Specific Language) embeded in the Java code.