0

I'm attempting to use MRUnit, but none of the examples I've seen quite match what I'm trying to do.

My reducer outputs a key and mutation, but I can't seem to compare the mutation with what's expected. It shows the objects as being the same, but with an address of 0 and the following error:

junit.framework.AssertionFailedError: expected: <org.apache.accumulo.core.data.Mutation@0> but was <org.apache.accumulo.core.data.Mutation@0>

I'm using the reduceDriver.run() method, and attempting assertEquals on my expected mutation object with the actual. Is there anything I'm missing?

Thanks for any input.

CNDyson
  • 1,687
  • 7
  • 28
  • 63

3 Answers3

0

Mutation does not have an appropriate equals() implementation. you're best bet is to probably compare the results of getUpdates() and getRow(). They return a List and byte[] respectively and those are easily comparable.

ohshazbot
  • 894
  • 3
  • 8
  • 16
0

Mutation has an appropriate equals() method, at least it does in the 1.4.x line. However, that method calls a private serialize() method that modifies the data about to be checked.

I've gotten around this in the past by wrapping the Mutation in a new Mutation, which calls serialize under the hood:

 assertEquals(expectedMutation, new Mutation(actualMutation));
0

You can extend Mutation and pass the new class to mrunit. Just override equals in the new class.

David Medinets
  • 5,160
  • 3
  • 29
  • 42