Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.9.0
-
None
Description
We should allow users to mock the Context object. I have thought about this and I think there are two ways to go about it. In MRUnit we have a single codebase which supports Hadoop 0.20 - 2.0.
However, Context itself was changed from a class in 0.20 to an interface in > 0.20. As such, we use Mockito to create the object regardless of the version of Hadoop the user is using.
There are two ways to implement providing a custom context to MRUnit.
1) User provides MRUnit context object
Pros
User can use any mocking tool they wish
Cons
Puts massive ugliness into MRUnit code (I implemented this)
MRUnit is not providing much value since inputs/outputs and such come from Context.
2) User can "get" context from MRUnit and then override any mocked methods via Mockito
Pros
Much cleaner to implement
Cons
User must use Mockito to override methods on context