### Question:
ModularityOptimization extends Algorithm<ModularityOptimization, ModularityOptimization> { @Override public ModularityOptimization compute() { progressLogger.logMessage(":: Start"); progressLogger.logMessage(":: Initialization :: Start"); computeColoring(); initSeeding(); init(); progressLogger.logMessage(":: Initialization :: Finished"); for (iterationCounter = 0; iterationCounter < maxIterations; iterationCounter++) { progressLogger.logMessage(formatWithLocale(":: Iteration %d :: Start", iterationCounter + 1)); boolean hasConverged; nodeCommunityInfluences.fill(0.0); long currentColor = colorsUsed.nextSetBit(0); while (currentColor != -1) { assertRunning(); optimizeForColor(currentColor); currentColor = colorsUsed.nextSetBit(currentColor + 1); } hasConverged = !updateModularity(); progressLogger.logMessage(formatWithLocale(":: Iteration %d :: Finished", iterationCounter + 1)); if (hasConverged) { this.didConverge = true; iterationCounter++; break; } progressLogger.reset(graph.relationshipCount()); } progressLogger.logMessage(":: Finished"); return this; } ModularityOptimization(
        final Graph graph,
        int maxIterations,
        double tolerance,
        @Nullable NodeProperties seedProperty,
        int concurrency,
        int minBatchSize,
        ExecutorService executor,
        ProgressLogger progressLogger,
        AllocationTracker tracker
    ); @Override ModularityOptimization compute(); @Override ModularityOptimization me(); @Override void release(); long getCommunityId(long nodeId); int getIterations(); double getModularity(); boolean didConverge(); double getTolerance(); LongNodeProperties asNodeProperties();  }### Answer:
@Test void testLogging() { var testLogger = new TestProgressLogger( graph.relationshipCount(), "ModularityOptimization", 3 ); compute(graph, 3, null, 3, 2, testLogger); assertTrue(testLogger.containsMessage(INFO, ":: Start")); assertTrue(testLogger.containsMessage(INFO, "Initialization :: Start")); assertTrue(testLogger.containsMessage(INFO, "Initialization :: Finished")); assertTrue(testLogger.containsMessage(INFO, "Iteration 1 :: Start")); assertTrue(testLogger.containsMessage(INFO, "Iteration 1 :: Finished")); assertTrue(testLogger.containsMessage(INFO, ":: Finished")); }
@Test void requireAtLeastOneIteration() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, () -> compute(graph, 0, null, 3, 2, ProgressLogger.NULL_LOGGER) ); assertTrue(exception.getMessage().contains("at least one iteration")); }