G'day:
This is mostly for
Brad Wood, but it might be of passable interest to others, so I'll plonk it here.
Yesterday's article discussed how
contains is kind of a reserved word, but kind of not in ColdFusion (it's just
not in Railo). I observed to Brad that this actually bites us on the bum with Mockbox, and he
asked for more info, so here it is.
Basically we use a caching system which has a method "contains" which checks to see if there's an item with a given key already in the cache, before trying to fetch it. We've actually since revised this approach, but we have some legacy code still using methods called "
contains". So we need to unit test them, and indeed their responses play a part in other methods we test. When testing these other methods which use the caching system, we mock-out the cache, and the methods within it, and we use
Mockbox to do this. Mockbox is cool, btw. You should be using it if yer not already.
We're still using Mockbox 1.3 (more about why further down), and it is impossible to directly mock a method called
contains using Mockbox. We've worked around this, but it took a bloody long time to work out what the hell was going on, and that there was working-around to do.