### Question:
DeepSparkContext extends JavaSparkContext implements Serializable { public DataFrame createJavaSchemaRDD(ExtractorConfig<Cells> config) throws UnsupportedDataTypeException, UnsupportedOperationException { JavaRDD<Cells> cellsRDD = createJavaRDD(config); JavaRDD<Row> rowsRDD = DeepSparkContext.createJavaRowRDD(cellsRDD); try { Cells firstCells = cellsRDD.first(); StructType schema = CellsUtils.getStructTypeFromCells(firstCells); return sqlContext.applySchema(rowsRDD, schema); } catch(UnsupportedOperationException e) { throw new UnsupportedOperationException("Cannot infer schema from empty data RDD", e); } } DeepSparkContext(SparkContext sc);  DeepSparkContext(String master, String appName);  DeepSparkContext(String master, String appName, String sparkHome, String jarFile);  DeepSparkContext(String master, String appName, String sparkHome, String[] jars);  DeepSparkContext(String master, String appName, String sparkHome, String[] jars,
                            Map<String, String> environment);  DeepSparkContext(DeepSparkConfig deepSparkConfig); @Override SparkContext sc(); RDD<T> createRDD(ExtractorConfig<T> config); RDD<T> createRDD(DeepJobConfig<T, ?> deepJobConfig); JavaRDD<T> createJavaRDD(
            ExtractorConfig<T> config); JavaRDD<T> createJavaRDD(DeepJobConfig<T, ?> config); static JavaRDD<Row> createJavaRowRDD(JavaRDD<Cells> cellsRDD); DataFrame createJavaSchemaRDD(ExtractorConfig<Cells> config); DataFrame sql(String query); static void saveRDD(RDD<T> rdd, S config, UpdateQueryBuilder queryBuilder); static void saveRDD(RDD<T> rdd, S config); SQLContext getSQLContext(); RDD textFile(ExtractorConfig<Cells> config); RDD<Cells> createHDFSRDD(ExtractorConfig<Cells> config); RDD<Cells> createS3RDD(ExtractorConfig<Cells> config);  }### Answer:
@Test public void createJavaSchemaRDDTest() throws Exception { deepSparkContext = createDeepSparkContext(); DeepSparkContext deepSparkContextSpy = PowerMockito.spy(deepSparkContext); SQLContext sqlContext = PowerMockito.mock(SQLContext.class); ExtractorConfig config = createDeepJobConfig(); Whitebox.setInternalState(deepSparkContextSpy, "sc", sparkContext); Whitebox.setInternalState(deepSparkContextSpy, "sqlContext", sqlContext); PowerMockito.doReturn(singleRdd).when(deepSparkContextSpy).createJavaRDD(config); JavaRDD<Row> rowRDD = mock(JavaRDD.class); mockStatic(DeepSparkContext.class); when(DeepSparkContext.createJavaRowRDD(singleRdd)).thenReturn(rowRDD); Cells cells = mock(Cells.class); when(singleRdd.first()).thenReturn(cells); StructType schema = mock(StructType.class); mockStatic(CellsUtils.class); when(CellsUtils.getStructTypeFromCells(cells)).thenReturn(schema); deepSparkContextSpy.createJavaSchemaRDD(config); verify(sqlContext).applySchema(rowRDD, schema); }