JetBrains-Research / JetBrains-Research/TestSpark
[Kotlin] Package directive does not match file location & test cases do not see modifications in the file under test
- Dominant language
- Kotlin
- Stars
- 88
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
### How it works for Java
The following java class
```java
package org.tests;
public class GeneratedMethodPublicInvokesPrivateTest {
@Test
public void methodPublicInvokesPrivateTest() {
}
}
```
is located in
`/private/var/folders/pm/<>/T/testSparkResults/test_gen_result_<>/org/tests/GeneratedMethodPublicInvokesPrivateTest.java`
And the IDEA see that the package name and the location (the suffix of the path) matches. So we can have the proper access to the package elements.
### How it works for Kotlin
The following kotlin class
```kotlin
package org.example
class GeneratedConstructorPrimaryNameOnlyTest {
@Test
fun constructorPrimaryNameOnlyTest() {
}
}
```
is located in
`/private/var/folders/pm/<>/T/testSparkResults/test_gen_result_<>/org/example/GeneratedConstructorPrimaryNameOnlyTest.kt`
But IDEA shows me the warning: **Package directive does not match the file location**. So we have the problem with access.
For example, we can not access, so the compilation for all tests of this class will fail.
```kotlin
internal class MyClass(private val name: String) {}
```
Contributor guide
Assessment
This issue has not been assessed yet.