Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # user >> how to unit test my RawComparator

Copy link to this message
how to unit test my RawComparator
i have a RawComparator that i would like to unit test (using mockito and
mrunit testing packages). i want to test the method,

public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)

how do i convert my custom key into a byte[] array? is there a util class
to help me do this?

also, when i put the code into the debugger, i notice that the byte[]
arrays (b1 and b2) are HUGE (the lengths of each array are huge, in the
thousands). what is actually in these byte[] arrays? intuitively, it does
not seem like these byte[] arrays only represent my keys.

lastly, why are such huge byte[] arrays being passed around? one would
think that since Java is pass-by-value, there would be a large overhead
with passing such large byte arrays around.

your help is appreciated.