@Test
public void readDocuments() throws Exception {

    
    // given
    
    doReturn(documentsWritable).when(sparkContext).sequenceFile("/path/to/documents/", Text.class, BytesWritable.class);
    doReturn(documents).when(documentsWritable).mapToPair(any());
    
    
    // execute
    
    JavaPairRDD<String, MatchableEntity> retDocuments = inputReader.readDocuments(sparkContext, "/path/to/documents/");
    
    
    // assert
    
    assertTrue(retDocuments == documents);
    
    verify(sparkContext).sequenceFile("/path/to/documents/", Text.class, BytesWritable.class);
    verify(documentsWritable).mapToPair(mapToEntityFunction.capture());
    assertMapToEntityFunction(mapToEntityFunction.getValue());
    
}