Skip to content
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

Recommended Kotlin directory structure is unsupported #352

Open
micheljung opened this issue Jan 20, 2023 · 4 comments
Open

Recommended Kotlin directory structure is unsupported #352

micheljung opened this issue Jan 20, 2023 · 4 comments

Comments

@micheljung
Copy link

From the Kotlin coding conventions:

Source code organization

Directory Structure

In pure Kotlin projects, the recommended directory structure follows the package structure with the common root package omitted. For example, if all the code in the project is in the org.example.kotlin package and its subpackages, files with the org.example.kotlin package should be placed directly under the source root, and files in org.example.kotlin.network.socket should be in the network/socket subdirectory of the source root.

However, if you do this, you get:

Didn't find org.example.kotlin.network.socket.ExampleTest under C:\work\example
com.spun.util.FormattedException: org.example.kotlin.network.socket.ExampleTest under C:\work\example
	at app//com.spun.util.ClassUtils.getSourceDirectory(ClassUtils.java:103)
	at app//com.spun.util.ClassUtils.getSourceDirectory(ClassUtils.java:108)
	at app//com.spun.util.tests.TestUtils.getInfo(TestUtils.java:214)
	at app//com.spun.util.tests.TestUtils.getCurrentFileForMethod(TestUtils.java:201)
	at app//com.spun.util.tests.TestUtils.getCurrentFileForMethod(TestUtils.java:193)
	at app//org.approvaltests.namer.StackTraceNamer.<init>(StackTraceNamer.java:17)
	at app//org.approvaltests.Approvals$1.load(Approvals.java:41)
	at app//org.approvaltests.Approvals$1.load(Approvals.java:38)
	at app//org.approvaltests.Approvals.createApprovalNamer(Approvals.java:257)
	at app//com.spun.util.ArrayUtils.getOrElse(ArrayUtils.java:302)
	at app//org.approvaltests.core.Options$FileOptions.getNamer(Options.java:104)
	at app//org.approvaltests.Approvals.verify(Approvals.java:183)
	at app//org.approvaltests.Approvals.verify(Approvals.java:50)
	at app//org.approvaltests.Approvals.verify(Approvals.java:59)
	at app//org.approvaltests.combinations.CombinationsHelper.verifyAllCombinations(CombinationsHelper.java:27)
	at app//org.approvaltests.combinations.CombinationApprovals.verifyAllCombinations(CombinationApprovals.java:205)
	at app//org.approvaltests.combinations.CombinationApprovals.verifyAllCombinations(CombinationApprovals.java:194)
	at app//org.approvaltests.combinations.CombinationApprovals.verifyAllCombinations(CombinationApprovals.java:50)
@LarsEckart
Copy link
Contributor

hello,

any chance you can point us to a project that uses that structure, or perhaps even create a project with just a few files to play around with this use-case?

@micheljung
Copy link
Author

micheljung commented Apr 12, 2023

Hi, I'll try to next week.

@micheljung
Copy link
Author

@LarsEckart
Copy link
Contributor

oh wow, skipping the folders for root level but still declaring package for them, now I understand. That will be interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants