### Question:
IndexPopulationProgress { public float getCompletedPercentage() { return totalCount > 0 ? ((float) (completedCount * 100) / totalCount) : 0.0f; } IndexPopulationProgress( long completed, long total ); float getCompletedPercentage(); long getCompletedCount(); long getTotalCount(); @Override String toString(); static final IndexPopulationProgress NONE; static final IndexPopulationProgress DONE; }### Answer:
@Test void testNone() { assertEquals( 0, IndexPopulationProgress.NONE.getCompletedPercentage(), 0.01 ); }
@Test void testDone() { assertEquals( 100, IndexPopulationProgress.DONE.getCompletedPercentage(), 0.01 ); }
@Test void testGetCompletedPercentage() { IndexPopulationProgress progress = new IndexPopulationProgress( 1, 2 ); assertEquals( 50.0f, progress.getCompletedPercentage(), 0.01f ); }