Using jmock how to reuse parameter

Posted by BenZen on Stack Overflow See other posts from Stack Overflow or by BenZen
Published on 2010-05-25T21:30:10Z Indexed on 2010/05/25 22:31 UTC
Read the original article Hit count: 262

Filed under:
|
|
|
|

I'm building a test, in wich i need to send question, and wait for the answer. Message passing is not the problem. In fact to figure out wich answer correspond to wich question, i use an id. My id is generated using an UUID. an i want to retrieve this id, wich is given as a parameter to a mocked object. It look like this:

  oneOf(message).setJMSCorrelationID(with(correlationId));
           inSequence(sequence);

Where correlationId is the string i'd like to keep for an other expecteation like this one:

   oneOf(session).createBrowser(with(inputChannel), 
           with("JMSType ='pong' AND JMSCorrelationId = '"+correlationId+"'"));

have you got an answer?

© Stack Overflow or respective owner

Related posts about java

Related posts about unit-testing