Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
Copy link
Owner

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?

Copy link
Contributor Author

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

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);
Copy link
Owner

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

}
}