[ 
https://issues.apache.org/jira/browse/MRUNIT-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brock Noland updated MRUNIT-122:
--------------------------------

    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

  was:
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)

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

    
> Context should be mockable
> --------------------------
>
>                 Key: MRUNIT-122
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-122
>             Project: MRUnit
>          Issue Type: Improvement
>    Affects Versions: 0.9.0
>            Reporter: Brock Noland
>
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to