Skip to content

Commit

Permalink
Rename listener methods that operate on TestPlan level
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Oct 28, 2015
1 parent d10441a commit db7c029
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Expand Up @@ -28,27 +28,27 @@ public ColoredPrintingTestListener(PrintStream out) {
}

@Override
public void testExecutionStarted() {
public void testPlanExecutionStarted() {
out.println("Test execution started.");
}

@Override
public void testExecutionPaused() {
public void testPlanExecutionPaused() {
out.println("Test execution paused.");
}

@Override
public void testExecutionRestarted() {
public void testPlanExecutionRestarted() {
out.println("Test execution continued.");
}

@Override
public void testExecutionStopped() {
public void testPlanExecutionStopped() {
out.println("Test execution canceled.");
}

@Override
public void testExecutionFinished() {
public void testPlanExecutionFinished() {
out.println(ANSI_RESET);
}

Expand Down
Expand Up @@ -27,28 +27,28 @@ public TestSummaryReportingTestListener(PrintStream out) {
}

@Override
public void testExecutionStarted() {
public void testPlanExecutionStarted() {
timeStarted = System.currentTimeMillis();
}

@Override
public void testExecutionPaused() {
public void testPlanExecutionPaused() {
timePaused = System.currentTimeMillis();
}

@Override
public void testExecutionRestarted() {
public void testPlanExecutionRestarted() {
timeStarted += System.currentTimeMillis() - timePaused;
timePaused = 0;
}

@Override
public void testExecutionStopped() {
public void testPlanExecutionStopped() {
reportSummary("Test run stopped");
}

@Override
public void testExecutionFinished() {
public void testPlanExecutionFinished() {
reportSummary("Test run finished");
}

Expand Down
Expand Up @@ -5,11 +5,11 @@
* @since 5.0
*/
public interface TestListener {
default void testExecutionStarted() {};
default void testExecutionPaused() {};
default void testExecutionRestarted() {};
default void testExecutionStopped() {};
default void testExecutionFinished() {};
default void testPlanExecutionStarted() {};
default void testPlanExecutionPaused() {};
default void testPlanExecutionRestarted() {};
default void testPlanExecutionStopped() {};
default void testPlanExecutionFinished() {};

default void testFound(TestDescriptor testDescriptor) {};
default void testStarted(TestDescriptor testDescriptor) {};
Expand Down
@@ -1,13 +1,13 @@
package org.junit.gen5.launcher;

import static org.junit.gen5.engine.TestEngineRegistry.lookupAllTestEngines;
import static org.junit.gen5.engine.TestListenerRegistry.notifyListeners;

import org.junit.gen5.engine.TestEngine;
import org.junit.gen5.engine.TestListener;
import org.junit.gen5.engine.TestListenerRegistry;
import org.junit.gen5.engine.TestPlanConfiguration;

import static org.junit.gen5.engine.TestEngineRegistry.lookupAllTestEngines;
import static org.junit.gen5.engine.TestListenerRegistry.notifyListeners;

public class Launcher {

public void registerTestListener(TestListener testListener) {
Expand All @@ -23,12 +23,12 @@ public TestPlan createTestPlanWithConfiguration(TestPlanConfiguration configurat
}

public void execute(TestPlan testPlan) {
notifyListeners(TestListener::testExecutionStarted);
notifyListeners(TestListener::testPlanExecutionStarted);

for (TestEngine testEngine : lookupAllTestEngines()) {
testEngine.execute(testPlan.getAllTestsForTestEngine(testEngine));
}

notifyListeners(TestListener::testExecutionFinished);
notifyListeners(TestListener::testPlanExecutionFinished);
}
}

0 comments on commit db7c029

Please sign in to comment.