#667 Add/Fix javadoc, clarify supported modes of concurrency.

This commit is contained in:
Andreas Gudian 2015-11-06 23:29:01 +01:00
parent aba26328ba
commit 58e7079ad5
5 changed files with 14 additions and 18 deletions

View File

@ -33,7 +33,7 @@ import org.mapstruct.ap.testutil.compilation.annotation.ProcessorOption;
/** /**
* A JUnit4 runner for Annotation Processor tests. * A JUnit4 runner for Annotation Processor tests.
* <p> * <p>
* Test classes are safe to be executed in parallel, the methods must not executed in parallel. * Test classes are safe to be executed in parallel, but test methods are not safe to be executed in parallel.
* <p> * <p>
* The classes to be compiled for a given test method must be specified via {@link WithClasses}. In addition the * The classes to be compiled for a given test method must be specified via {@link WithClasses}. In addition the
* following things can be configured optionally : * following things can be configured optionally :

View File

@ -20,6 +20,12 @@ package org.mapstruct.ap.testutil.runner;
import org.mapstruct.ap.testutil.compilation.model.CompilationOutcomeDescriptor; import org.mapstruct.ap.testutil.compilation.model.CompilationOutcomeDescriptor;
/**
* Remembers the last {@link CompilationRequest} together with the outcome of that request. Consecutive tests that
* request the same compilation can reuse the results from this holder.
*
* @author Andreas Gudian
*/
class CompilationCache { class CompilationCache {
private String lastSourceOutputDir; private String lastSourceOutputDir;
private CompilationRequest lastRequest; private CompilationRequest lastRequest;

View File

@ -30,7 +30,7 @@ import org.mapstruct.ap.MappingProcessor;
import org.mapstruct.ap.testutil.compilation.model.CompilationOutcomeDescriptor; import org.mapstruct.ap.testutil.compilation.model.CompilationOutcomeDescriptor;
/** /**
* Statement that uses the JDK compiler to compile. * Statement that uses the Eclipse JDT compiler to compile.
* *
* @author Andreas Gudian * @author Andreas Gudian
*/ */

View File

@ -39,7 +39,11 @@ import org.mapstruct.ap.testutil.assertions.JavaFileAssert;
*/ */
public class GeneratedSource implements TestRule { public class GeneratedSource implements TestRule {
private static ThreadLocal<CompilingStatement> compilingStatement = new ThreadLocal<CompilingStatement>();; /**
* static ThreadLocal, as the {@link CompilingStatement} must inject itself statically for this rule to gain access
* to the statement's information. As test execution of different classes in parallel is supported.
*/
private static ThreadLocal<CompilingStatement> compilingStatement = new ThreadLocal<CompilingStatement>();
@Override @Override
public Statement apply(Statement base, Description description) { public Statement apply(Statement base, Description description) {

View File

@ -24,24 +24,10 @@ import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
import org.junit.runners.model.TestClass; import org.junit.runners.model.TestClass;
import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
import org.mapstruct.ap.testutil.compilation.annotation.ProcessorOption;
/** /**
* A JUnit4 runner for Annotation Processor tests. * Internal test runner that runs the tests of one class for one specific compiler implementation.
* <p>
* Test classes and test methods are safe to be executed in parallel.
* <p>
* The classes to be compiled for a given test method must be specified via {@link WithClasses}. In addition the
* following things can be configured optionally :
* <ul>
* <li>Processor options to be considered during compilation via {@link ProcessorOption}.</li>
* <li>The expected compilation outcome and expected diagnostics can be specified via {@link ExpectedCompilationOutcome}
* . If no outcome is specified, a successful compilation is assumed.</li>
* </ul>
* *
* @author Gunnar Morling
* @author Andreas Gudian * @author Andreas Gudian
*/ */
class InnerAnnotationProcessorRunner extends BlockJUnit4ClassRunner { class InnerAnnotationProcessorRunner extends BlockJUnit4ClassRunner {