// iterate and validate stuff ...
while (reader.nextKeyValue()) {
Text key = reader.getCurrentKey();
BytesWritable value = reader.getCurrentValue();
TestRecord testRecord = records.get(itemIndex++);
// get test key bytes as utf-8 bytes ...
byte[] testKeyBytes = testRecord.url.getBytes(Charset.forName("UTF-8"));
// compare against raw key bytes to validate key is the same (Text's utf-8 mapping code replaces invalid characters
// with ?, which causes our test case (which does use invalid characters to from the key, to break.
Assert.assertTrue(ArcFileReaderTests.compareTo(testKeyBytes,0,testKeyBytes.length,key.getBytes(),0,key.getLength()) == 0);