PCSpectra wrote: the code would potentially break if the order of invocation was changed, so perhaps writing a spec to assert this expectation wouldn't be a bad idea???
Possibly yeah your code could break, but think about the ways in which it can "break", can you test for those conditions? In my opinion as long as the proper return values are generated, without exceptions or errors, the code didn't "break" and a test telling you otherwise is a brittle test which is a "test smell". For instance maybe there are 5 method calls but only 2 of them depend on calling order, a) rather then having to figure this out, and b) figure out how to specify it in a test you could just test for the proper return values, then later [if/when] you mess with that code you have the flexibility to change more code than if you had tested the implementation.
For instance if you call you methods in order 1,2,3,4,5 and later spot that by calling them in orders 1,2,4,3,5 you get some benefit from an extensibility standpoint, your test should not fail just because you re-organized code ( Unless it was reorganized in a way that changed the return values! ). Maybe you originally were right that it had to be called all in order, maybe not... or maybe other code changed which changed that. why spend the time figuring that out now though?
Like maybe changing the order of the calls means a log file doesnt get created, so test that the log file gets created, that way your test tells you in English "log file not created", rather then "xyz configurator called in wrong order" ( which could mean 10,000,000 other things other then the log file.. leaving you to do further debugging.. ugh )... think plain English, not implementation... 1 granular condition per test
I would only try to test implementation for certain classes, like "system boundaries", like testing the DOC log class you might want to test it's outbound calls to a stream class if the real logging action is expensive, wether you do this via mock's with "expected" calls or stubs is not what you were asking, I think..