@Test public void testProgress() { Map<SparkStage, SparkStageProgress> progressMap = progressMap(); updateFunction.printStatus(progressMap, null); String testOutput = errContent.toString(); assertTrue(testOutput.contains( "Stage-1_0: 3(+1)/4\tStage-3_1: 4(+1,-1)/6\tStage-9_0: 5/5 Finished\tStage-10_2: 3(+2)/5\t" + "Stage-15_1: 3(+1)/4\tStage-15_2: 4/4 Finished\tStage-20_3: 1(+1,-1)/3\tStage-21_1: 2/2 Finished")); String[] testStrings = new String[]{ "STAGES ATTEMPT STATUS TOTAL COMPLETED RUNNING PENDING FAILED", "Stage-1 ...... 0 RUNNING 4 3 1 0 0", "Stage-3 ..... 1 RUNNING 6 4 1 1 1", "Stage-9 ........ 0 FINISHED 5 5 0 0 0", "Stage-10 .... 2 RUNNING 5 3 2 0 0", "Stage-15 ..... 1 RUNNING 4 3 1 0 0", "Stage-15 ....... 2 FINISHED 4 4 0 0 0", "Stage-20 .. 3 RUNNING 3 1 1 1 1", "Stage-21 ....... 1 FINISHED 2 2 0 0 0", "STAGES: 03/08 [===================>>-------] 75% ELAPSED TIME:"}; for(String testString : testStrings) { assertTrue(testOutput.contains(testString)); } }