I'm trying to write some tests with the mrunit framework, but running
into a snag.
It seems that the mock Context objects that are being created are always
using a new, empty Configuration object. However, I've written my
reducer to implement Configurable, since in production I'm going to be
passing certain specific parameters in to it as properties set on the
Configuration object. But with the Context always passing it an empty
Configuration, the Reducer will fail the tests.
What I'm looking for is a way to initialize the reducer using a
particular Configuration object, which contains the parms/properties
that the reducer needs. I looked at the ReduceDriver class, however,
and there doesn't seem to be any way to do that.
I suppose I could explicitly call my reducer's setConf() method before I
run my test, in order to give it a correct configuration. However, it
looks like what'll happen is that then later setConf() will get called a
second time with the empty configuration, which will cause an exception
getting thrown by my reducer. (Unless I mod my code to avoid this.)
Is there any way around this conundrum without my being forced to add a
hack to my reducer for this? I.e., any way to initialize the mrunit
framework to use a specific config when it runs a test?
TIA,
DR
- mrunit question David Rosenstrauch
-