Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

[jmock-user] Matcher for List inside of bean?

kheasman

2008-06-06

Replies: Find Java Web Hosting

Author LoginPost Reply
Good day. I've just started using jMock after realizing EasyMock does not do it
for us. Great lib so far.

Does the 'equal' matcher work to match elements of a List inside of a bean? For
instance, here's my expectations snippet:

final JobBean bean = new JobBean();
bean.setId("A");
bean.addIdToList(1);

context.checking(new Expectations() {{
one(senderMock).sendMessage(with(equal(bean)));
}});

However, I get:

unexpected invocation
unexpected invocation: sender.sendMessage(<xxx.JobBean@(protected)]]>)

The JobBean is simple:

public class JobBean {
private List<Integer> idList;

public addIdToList(Integer id) {
  if (idList == null) {
   idList = new Vector<Integer>();
  }
  idList.add(id);
}

public List<Integer> getIdList() {
  return idList;
}

...

I can write a custom Matcher but I want to be sure I'm using the jMock
functionality correctly.

thanks in advance.

k.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.