mrunit-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dipesh Khakhkhar <dipeshsoftw...@gmail.com>
Subject Re: Mapper unit test failing - validation failing
Date Wed, 28 Nov 2012 22:36:56 GMT
Found the problem - I have to use my customized equals or compare method as
I have List<Object> and there were different objects and as a result of
that it was failing.

Thanks.

On Wed, Nov 28, 2012 at 12:44 PM, Dipesh Khakhkhar <dipeshsoftware@gmail.com
> wrote:

> Brock,
> Thanks for replying. Yes I am using a custom key. After searching I found
> that I have to override equals and hashcode method.
>
> In my custom key, I am using list of objects i.e. List<Object> as it's
> member variable and i tried to use the following -
>
> public boolean equals(Object o) {
> if (o instanceof MyCustomKey) {
> MyCustomKey myKey = (MyCustomKey) o;
>  return mylist.equals(myKey.getList()) ;
> }
> return false;
>  }
>
> but the above call is failing. In eclipse debugger it is showing same
> values and size for both the lists but myKey.getList() has different
> modCount than myList.
>
> I have overridden hashcode method too. Am i missing something above?
>
> Thanks.
>
>
> On Wed, Nov 28, 2012 at 7:58 AM, Brock Noland <brock@cloudera.com> wrote:
>
>> What are you using for output Key? Is it a custom writable?
>>
>>
>> On Tue, Nov 27, 2012 at 11:14 PM, Dipesh Khakhkhar <
>> dipeshsoftware@gmail.com> wrote:
>>
>>> I'm using MRUnit to test my M/R classes.
>>>
>>> My mapper is simple one
>>>
>>> - It takes input file with input like
>>> 1
>>> 2
>>> 3
>>>
>>> - Its outputs is
>>> Key 0,0,0
>>> Value 1,
>>>
>>> key 0,0,1
>>> Value 2,
>>>
>>> Now I am using MRUnit to test my mapper with following input and
>>> expected output -
>>>
>>> Input: "1"
>>> Expected Output: like this mapDriver.withOutput(key, new Text("1,") );
>>> // where my key is 0,0,0
>>>
>>> I'm getting following error
>>>
>>> java.lang.AssertionError: 2 Error(s): (Missing expected output (0,0,0,,
>>> 1,) at position 0., Received unexpected output (0,0,0,, 1,) at position 0.)
>>>
>>> It seems to me my output is correct (lhs==rhs) - am i missing something
>>> above? Please correct me if I'm wrong.
>>>
>>> Thanks in advance for replying and answering my query.
>>>
>>> Thanks.
>>>
>>>
>>
>>
>> --
>> Apache MRUnit - Unit testing MapReduce -
>> http://incubator.apache.org/mrunit/
>>
>
>

Mime
View raw message