#Hey, I have a problem with Junit, can someone help me with the code ?
42 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @placid grove! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
sourceSets {
test {
java {
srcDirs = 'src'
}
}
}
@placid grove
still not working
In that case we'll swap to the more traditional approach, let me knab a screenshot
This is the traditional approach in Java Projects, we don't really do test files next to implementation files like you might see in TS/JS land.
Not in /src, in your case it would be in the root
Both are just folders
They only look special because of IntelliJ
You also need
test {
useJUnitPlatform()
}
In your build.gradle
okay wait
yeah but when I create a test directory out of src
and create a java directory in the test directory
then it doesn't recognize the imports
and I added
the useJUnitPlatform()
it should be src/test/java normally, not test/java - but using a different structure is possible
In this case package works
It's mostly acting up because you defined the source location in build.gradle. /src/main is the default, so you don't need to specify it.
And the build.gradle
still doesn't work
sadly nothing works