org.junitpioneer.jupiter.TempDirectory.TempDir Java Examples

The following examples show how to use org.junitpioneer.jupiter.TempDirectory.TempDir. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JoinfacesPluginIT.java    From joinfaces with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = {"5.1.1", "5.4.1", "5.6.2"})
public void build(String gradleVersion, @TempDir Path projectDir) throws IOException {
	Files.write(projectDir.resolve("settings.gradle"), Collections.singleton("rootProject.name = 'dummy'"));

	Files.write(projectDir.resolve("build.gradle"), Arrays.asList(
			"plugins {",
			"    id 'java'",
			"    id 'groovy'",
			"    id 'scala'",
			"    id 'org.joinfaces'",
			"}",
			"repositories { mavenCentral() }",
			"dependencies {",
			"    compile 'org.apache.myfaces.core:myfaces-impl:2.3.2'",
			"}"
	));

	BuildResult buildResult = GradleRunner.create()
			.withProjectDir(projectDir.toFile())
			.withPluginClasspath()
			.withArguments("jar", "-s", "--info")
			.withDebug(true)
			.withGradleVersion(gradleVersion)
			.build();

	BuildTask scanClasspath = buildResult.task(":scanJoinfacesClasspath");
	assertThat(scanClasspath).isNotNull();
	assertThat(scanClasspath.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);

	File jarFile = projectDir.resolve("build/libs/dummy.jar").toFile();
	assertThat(jarFile).isFile();

	try (ZipFile zipFile = new ZipFile(jarFile)) {
		assertThat(zipFile.getEntry("META-INF/joinfaces/org.apache.myfaces.ee.MyFacesContainerInitializer.classes")).isNotNull();
		assertThat(zipFile.getEntry("META-INF/joinfaces/org.apache.myfaces.spi.AnnotationProvider.classes")).isNotNull();
	}
}
 
Example #2
Source File: AssetTest.java    From jbake with MIT License 5 votes vote down vote up
@BeforeEach
public void setup(@TempDir Path folder) throws Exception {
    fixtureDir = new File(this.getClass().getResource("/fixture").getFile());
    this.folder = folder;
    config = (DefaultJBakeConfiguration) new ConfigUtil().loadConfig(fixtureDir);
    config.setDestinationFolder(folder.toFile());
    Assertions.assertEquals(".html", config.getOutputExtension());
}
 
Example #3
Source File: PioneerTest.java    From demo-junit-5 with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Test
@ExtendWith(TempDirectory.class)
void testTempDirInjection(@TempDir Path tempDir, TestReporter reporter) {
	assertNotNull(tempDir);
	reporter.publishEntry("Temporary directory", tempDir.toString());
}
 
Example #4
Source File: JBakeConfigurationInspectorTest.java    From jbake with MIT License 4 votes vote down vote up
@BeforeEach
public void setup(@TempDir Path folder) {
    this.folder = folder;
}
 
Example #5
Source File: ConfigUtilTest.java    From jbake with MIT License 4 votes vote down vote up
@BeforeEach
public void setup(@TempDir Path folder) {
    this.sourceFolder = folder;
    this.util = new ConfigUtil();
}