DocumentTextCacheStorageUtils { public static <T extends GenericRecord> JavaRDD<T> getRddOrEmpty(JavaSparkContext sc, SparkAvroLoader avroLoader, Path cacheRootDir, String existingCacheId, CacheRecordType cacheRecordType, Class<T> avroRecordClass) { return CacheMetadataManagingProcess.UNDEFINED.equals(existingCacheId) ? sc.emptyRDD() : avroLoader.loadJavaRDD(sc, DocumentTextCacheStorageUtils.getCacheLocation(cacheRootDir, existingCacheId, cacheRecordType).toString(), avroRecordClass); } private  DocumentTextCacheStorageUtils(); static Path getCacheLocation(Path cacheRootDir, String cacheId, CacheRecordType cacheRecordType); static JavaRDD<T> getRddOrEmpty(JavaSparkContext sc, SparkAvroLoader avroLoader,
            Path cacheRootDir, String existingCacheId, CacheRecordType cacheRecordType, Class<T> avroRecordClass); static void storeInCache(SparkAvroSaver avroSaver, JavaRDD<DocumentText> toBeStoredEntities, JavaRDD<Fault> toBeStoredFaults, 
            Path cacheRootDir, LockManager lockManager, CacheMetadataManagingProcess cacheManager, 
            Configuration hadoopConf, int numberOfEmittedFiles);  }
@Test public void getGetRddOrEmptyForNonExistingCache() { Path cacheRootDir = new Path("some/root/dir"); String existingCacheId = CacheMetadataManagingProcess.UNDEFINED; CacheRecordType cacheRecordType = CacheRecordType.text; Class<DocumentText> avroRecordClass = DocumentText.class; doReturn(true).when(emptyPredefinedRdd).isEmpty(); doReturn(emptyPredefinedRdd).when(sparkContext).emptyRDD(); JavaRDD<DocumentText> result = DocumentTextCacheStorageUtils.getRddOrEmpty(sparkContext, avroLoader, cacheRootDir, existingCacheId, cacheRecordType, avroRecordClass); assertNotNull(result); assertTrue(result.isEmpty()); assertTrue(emptyPredefinedRdd == result); }