hard to tell exactly what your code looks like. Could help you better if I knew the code you want to test.. but assuming your code you want to test looks like this:
private BlockingQueue<String> queue;
private List<String> myList = new ArrayList<String> ():
private void setBlockingQueue( BlockingQueue<String> queue ) {
this.queue = queue;
}
public List<String> getMyList() {
return myList;
}
public void setMyList( List<String> myList) {
this.myList = myList;
}
public void doWork() {
System.out.println("blah");
queue.drainTo( myList );
}
A test would be
public void testDoWork() {
List<String> stuffToDrain = new ArrayList<String>();
stuffToDrain.add( "foo" );
stuffToDrain.add( "bar" );
myTestingClass.setMyList( stuffToTrain );
BlockingQueue<String> queue = EasyMock.createMock( BlockingQueue.class );
myTestingClass.setBlockingQueue( queue );
queue.drainTo( stuffToDrain );
EasyMock.replay( queue );
myTestingClass.doWork();
EasyMock.verify( queue );
}
Sorry if that isn't right, but really hard to suggest a test for code that I can't see...
Edit - we can't really assert that the mutable param gets changed becuase of how we are using the mock. All we can do is assert that the drainTo method gets called. If drainTo does what we want to do would have to be tested elsewhere.. i.e. in the tests of BlockingQueue.class
Edit 2 - we can be more specific about what list we expect the method to get called with.