Package org.gradle.exemplar.test.rule
Class Sample
java.lang.Object
org.gradle.exemplar.test.rule.Sample
- All Implemented Interfaces:
org.junit.rules.TestRule
A JUnit rule which copies a sample into the test directory before the test executes.
Looks for a UsesSample annotation on the test method to determine which sample the
test requires. If not found, uses the default sample provided in the constructor.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceSupplier for the base directory into which samples are copied. -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) static Samplestatic Samplefrom(Sample.SourceSampleDirSupplier sourceSampleDirSupplier) getDir()into(Sample.TargetBaseDirSupplier targetBaseDirSupplier) Copy the samples into a folder returned by the suppliedSample.TargetBaseDirSupplier.into(org.junit.rules.TemporaryFolder temporaryFolder) Deprecated.Copy the samples into a temporary folder that is attempted to be deleted afterwards.intoTemporaryFolder(File parentFolder) Copy the samples into a temporary folder that is attempted to be deleted afterwards.withDefaultSample(String name)
-
Method Details
-
from
-
from
-
into
Deprecated.please useintoTemporaryFolder()orintoTemporaryFolder(File)Copy the samples into the suppliedTemporaryFolder. -
intoTemporaryFolder
Copy the samples into a temporary folder that is attempted to be deleted afterwards. -
intoTemporaryFolder
Copy the samples into a temporary folder that is attempted to be deleted afterwards.- Parameters:
parentFolder- The parent folder of the created temporary folder
-
into
Copy the samples into a folder returned by the suppliedSample.TargetBaseDirSupplier.- See Also:
-
withDefaultSample
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
applyin interfaceorg.junit.rules.TestRule
-
getDir
-
intoTemporaryFolder()orintoTemporaryFolder(File)