Scott Levey | 15 May 2011 15:56
Picon
Favicon

synchroniser and expectations


I've been playing around with the synchroniser... so far, it's working really 
good.. but I'm wondering if I might be using it a bit wrong.

Here's a simple test.

 <at> Test(timeout=1000)
public void testAddImmediateCommandOperation() {
	final States scheduling = context.states("scheduling");
	context.checking(new Expectations() {{
		oneOf(listener).beginTransaction(with(any(String.class)));
			when(scheduling.isNot("finished"));
			
		oneOf(listener).executeCommand(with(any(StipCommand.class)));
			will(returnValue(commandResponse));
			when(scheduling.isNot("finished"));
			
		oneOf(listener).commitTransaction(with(any(String.class)));
			then(scheduling.is("finished"));
	}});
	
	transactionScheduler.addCommandOperation(immediateDeleteUserCO);
	
	try {
		synchroniser.waitUntil(scheduling.is("finished"));
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		fail("Thread Fail");
	}
		context.assertIsSatisfied();
(Continue reading)


Gmane