-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to validate test resources directory
- Loading branch information
Clayton Walker
committed
Apr 19, 2022
1 parent
3492616
commit 5967c1e
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/test/java/org/gradle/playframework/plugins/PluginResourceDirectoryTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.gradle.playframework.plugins; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.api.file.SourceDirectorySet; | ||
import org.gradle.api.tasks.SourceSet; | ||
import org.gradle.playframework.plugins.internal.PlayPluginHelper; | ||
import org.gradle.testfixtures.ProjectBuilder; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class PluginResourceDirectoryTests { | ||
@Test | ||
public void testResourcesDirectories() { | ||
// given | ||
Project project = ProjectBuilder | ||
.builder() | ||
.build(); | ||
|
||
// when | ||
project.getPluginManager().apply(PlayPlugin.class); | ||
|
||
SourceSet mainSourceSet = PlayPluginHelper.getMainJavaSourceSet(project); | ||
SourceDirectorySet mainResourcesDirectorySet = mainSourceSet.getResources(); | ||
|
||
// then | ||
assertEquals( | ||
Collections.singleton(new File(project.getProjectDir(), "conf")), | ||
mainResourcesDirectorySet.getSrcDirs() | ||
); | ||
} | ||
|
||
@Test | ||
public void testTestResourcesDirectories() { | ||
// given | ||
Project project = ProjectBuilder | ||
.builder() | ||
.build(); | ||
|
||
// when | ||
project.getPluginManager().apply(PlayPlugin.class); | ||
|
||
SourceSet testSourceSet = PlayPluginHelper.getTestJavaSourceSet(project); | ||
SourceDirectorySet testResourcesDirectorySet = testSourceSet.getResources(); | ||
|
||
// then | ||
assertEquals( | ||
Collections.singleton(new File(project.getProjectDir(), "test/resources")), | ||
testResourcesDirectorySet.getSrcDirs() | ||
); | ||
} | ||
} |