Promote a mock
I knew it would happen eventually… As mentioned earlier all of the email filtering code has been developed without any sign of a main(). Now that the time has come to create the actual filter program I found that I didn’t actually have a real version of one of the objects that I required, I only had a mock version for testing. The thing is, the mock version is pretty much all I need for the real version, so it looks like it’s time to promote it…
Filters can be supplied with configuration data via the IManageFilterData
interface. Whilst testing the filters that I’ve been developing I’ve used a mock filter data manager. Now that I’m building the real filter process I find that I don’t have a real filter data manager. I expect that eventually I’ll need a filter data manager that reads configuration data from files or a database but right now some hard coded strings will do; and for that, the mock version does pretty much all I need.
So I’m going to hoist the mock filter data manager out of the test suite and into the production code. To do this I need to write a test for it and move it into the production code library. I’ll leave all of the tests using the mock version for now as I expect the production filter data manager will evolve reasonably quickly into something that doesn’t support the current functionality…