BytesWritableConverter implements Serializable { public Tuple2<String, DocumentWrapper> convertToDocumentWrapperTuple2(BytesWritable bytesWritable) { DocumentWrapper docWrapper = convertToDocumentWrapper(bytesWritable); return new Tuple2<>(docWrapper.getDocumentMetadata().getKey(), docWrapper); }  DocumentWrapper convertToDocumentWrapper(BytesWritable bytesWritable); Tuple2<String, DocumentWrapper> convertToDocumentWrapperTuple2(BytesWritable bytesWritable);  }
@Test public void convertToTuple2() { BytesWritable bytesWritable = new BytesWritable(docWrapper.toByteArray()); Tuple2<String, DocumentWrapper> retDocWrapperTuple2 = bytesWritableConverter.convertToDocumentWrapperTuple2(bytesWritable); DocumentWrapper retDocWrapper = retDocWrapperTuple2._2(); assertFalse(docWrapper == retDocWrapper); assertEquals(retDocWrapper.getDocumentMetadata().getKey(), docWrapper.getDocumentMetadata().getKey()); assertEquals(retDocWrapperTuple2._1(), docWrapper.getDocumentMetadata().getKey()); }