-
Couldn't load subscription status.
- Fork 10
adds a test case for testing module location in file manager #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,9 @@ | |
| import io.github.ascopes.jct.filemanagers.impl.JctFileManagerImpl; | ||
| import io.github.ascopes.jct.workspaces.PathRoot; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import javax.tools.JavaFileManager.Location; | ||
| import javax.tools.StandardLocation; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
|
|
@@ -76,4 +78,18 @@ void testAddPathForOutputLocation() { | |
| assertThat(jctFileManager.hasLocation(outputLocation)).isTrue(); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("Tests addPath method for adding module location") | ||
| void testAddPathForModuleLocation() { | ||
| var moduleLocation = StandardLocation.locationFor(StandardLocation.MODULE_PATH.name()); | ||
| var pathRoot = mock(PathRoot.class); | ||
| var path = Paths.get(".").normalize().toAbsolutePath(); | ||
|
|
||
| // we mock path because it is needed by AbstractPackageContainerGroup | ||
| given(pathRoot.getPath()).willReturn(path); | ||
|
|
||
| JctFileManagerImpl jctFileManager = JctFileManagerImpl.forRelease("test"); | ||
| jctFileManager.addPath(moduleLocation, pathRoot); | ||
| assertThat(jctFileManager.hasLocation(moduleLocation)).isEqualTo(true); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be able to just say .isTrue rather than .isEqualTo(true) here to keep it a little more concise There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same as just
var moduleLocation = StandardLocation.MODULE_PATH?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I will make the change