Skip to content

Commit

Permalink
Polish Javadoc in the Launcher module
Browse files Browse the repository at this point in the history
Issue: #234
  • Loading branch information
sbrannen committed May 28, 2016
1 parent f6b389f commit e425ee8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
Expand Up @@ -19,47 +19,50 @@
import org.junit.gen5.launcher.TestPlan;

/**
* An {@code ExecutionListenerAdapter} adapts a {@link TestPlan} and a corresponding
* {@link TestExecutionListener} to the {@link EngineExecutionListener} API.
*
* @since 5.0
*/
class ExecutionListenerAdapter implements EngineExecutionListener {

private final TestPlan testPlan;
private final TestExecutionListener testExecutionListener;

public ExecutionListenerAdapter(TestPlan testPlan, TestExecutionListener testExecutionListener) {
ExecutionListenerAdapter(TestPlan testPlan, TestExecutionListener testExecutionListener) {
this.testPlan = testPlan;
this.testExecutionListener = testExecutionListener;
}

@Override
public void dynamicTestRegistered(TestDescriptor testDescriptor) {
TestIdentifier testIdentifier = TestIdentifier.from(testDescriptor);
testPlan.add(testIdentifier);
testExecutionListener.dynamicTestRegistered(testIdentifier);
this.testPlan.add(testIdentifier);
this.testExecutionListener.dynamicTestRegistered(testIdentifier);
}

@Override
public void executionStarted(TestDescriptor testDescriptor) {
testExecutionListener.executionStarted(getTestIdentifier(testDescriptor));
this.testExecutionListener.executionStarted(getTestIdentifier(testDescriptor));
}

@Override
public void executionSkipped(TestDescriptor testDescriptor, String reason) {
testExecutionListener.executionSkipped(getTestIdentifier(testDescriptor), reason);
this.testExecutionListener.executionSkipped(getTestIdentifier(testDescriptor), reason);
}

@Override
public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) {
testExecutionListener.executionFinished(getTestIdentifier(testDescriptor), testExecutionResult);
this.testExecutionListener.executionFinished(getTestIdentifier(testDescriptor), testExecutionResult);
}

@Override
public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry) {
testExecutionListener.reportingEntryPublished(getTestIdentifier(testDescriptor), entry);
this.testExecutionListener.reportingEntryPublished(getTestIdentifier(testDescriptor), entry);
}

private TestIdentifier getTestIdentifier(TestDescriptor testDescriptor) {
return testPlan.getTestIdentifier(testDescriptor.getUniqueId().toString());
return this.testPlan.getTestIdentifier(testDescriptor.getUniqueId().toString());
}

}
Expand Up @@ -71,14 +71,14 @@ public final class TestDiscoveryRequestBuilder {
private Map<String, String> configurationParameters = new HashMap<>();

/**
* Returns a new {@link TestDiscoveryRequestBuilder}.
* Create a new {@code TestDiscoveryRequestBuilder}.
*/
public static TestDiscoveryRequestBuilder request() {
return new TestDiscoveryRequestBuilder();
}

/**
* Adds all of the supplied {@code selectors} to the request.
* Add all of the supplied {@code selectors} to the request.
*/
public TestDiscoveryRequestBuilder select(DiscoverySelector... selectors) {
if (selectors != null) {
Expand All @@ -88,7 +88,7 @@ public TestDiscoveryRequestBuilder select(DiscoverySelector... selectors) {
}

/**
* Adds all of the supplied {@code selectors} to the request.
* Add all of the supplied {@code selectors} to the request.
*/
public TestDiscoveryRequestBuilder select(List<DiscoverySelector> selectors) {
if (selectors != null) {
Expand All @@ -98,7 +98,7 @@ public TestDiscoveryRequestBuilder select(List<DiscoverySelector> selectors) {
}

/**
* Adds all of the supplied {@code filters} to the request.
* Add all of the supplied {@code filters} to the request.
*/
public TestDiscoveryRequestBuilder filter(Filter<?>... filters) {
if (filters != null) {
Expand All @@ -108,7 +108,7 @@ public TestDiscoveryRequestBuilder filter(Filter<?>... filters) {
}

/**
* Adds the supplied <em>configuration parameter</em> to the request.
* Add the supplied <em>configuration parameter</em> to the request.
*/
public TestDiscoveryRequestBuilder configurationParameter(String key, String value) {
Preconditions.notBlank(key, "configuration parameter key must not be null or empty");
Expand All @@ -117,7 +117,7 @@ public TestDiscoveryRequestBuilder configurationParameter(String key, String val
}

/**
* Adds all of the supplied {@code configurationParameters} to the request.
* Add all of the supplied {@code configurationParameters} to the request.
*/
public TestDiscoveryRequestBuilder configurationParameters(Map<String, String> configurationParameters) {
if (configurationParameters != null) {
Expand All @@ -139,13 +139,13 @@ else if (filter instanceof DiscoveryFilter<?>) {
else {
throw new PreconditionViolationException("Filter must implement " + EngineIdFilter.class.getSimpleName()
+ ", " + PostDiscoveryFilter.class.getSimpleName() //
+ " or " + DiscoveryFilter.class.getSimpleName() + ".");
+ ", or " + DiscoveryFilter.class.getSimpleName() + ".");
}
}

/**
* Builds and returns the {@link TestDiscoveryRequest} that has previously
* been setup by the methods of this builder.
* Build the {@link TestDiscoveryRequest} that has been configured via
* this builder.
*/
public TestDiscoveryRequest build() {
DiscoveryRequest discoveryRequest = new DiscoveryRequest();
Expand Down
@@ -1,10 +1,11 @@
/**
* The {@link org.junit.gen5.launcher.main.DefaultLauncher DefaultLauncher}
* class is the main starting point for running all JUnit tests.
* The {@link org.junit.gen5.launcher.Launcher Launcher} is the main starting
* point for launching a test suite.
*
* <p>The {@link org.junit.gen5.launcher.main.TestDiscoveryRequestBuilder
* TestDiscoveryRequestBuilder} serves as a small DSL for creating
* {@link org.junit.gen5.launcher.TestDiscoveryRequest TestDiscoveryRequests}.
* TestDiscoveryRequestBuilder} serves as a small DSL for creating a
* {@link org.junit.gen5.launcher.TestDiscoveryRequest TestDiscoveryRequest}
* that can be supplied to a launcher.
*/

package org.junit.gen5.launcher.main;
Expand Up @@ -231,7 +231,7 @@ public void exceptionForIllegalFilterClass() throws Exception {
PreconditionViolationException exception = expectThrows(PreconditionViolationException.class,
() -> request().filter(o -> excluded("reason")));

assertEquals("Filter must implement EngineIdFilter, PostDiscoveryFilter or DiscoveryFilter.",
assertEquals("Filter must implement EngineIdFilter, PostDiscoveryFilter, or DiscoveryFilter.",
exception.getMessage());
}
}
Expand Down

0 comments on commit e425ee8

Please sign in to comment.