Skip to content

Java tests for Kotlin files. Links in Java docs are not resolved #1279

Open
@alisevych

Description

@alisevych

Description

Generated Java tests for Kotlin files.
Kotlin code is addressed correctly from Java code.
But links in Java docs are not resolved.

To Reproduce

  1. Install the latest UnitTestBot plugin build from main in IntelliJ Idea 2022.2.3 (latest)
  2. Set Java as the language to generate tests in
  3. Create a project with Kotlin support
  4. Create a package in src/main/kotlin sources root
  5. Add the following code to a Kotlin file:
package ort.utbot.examples.functions

fun foo(name: String, number: Int = 42, toUpperCase: Boolean = false) =
    (if (toUpperCase) name.uppercase() else name) + number
  1. Generate tests for the file
  2. Render Java docs and check the links

Expected behavior

Links in Java docs are supposed to lead to the used code.

Actual behavior

Links in Java docs are not resolved.

Visual proofs (screenshots, logs, images)

    /**
     * @utbot.classUnderTest {@link DefaultArgumentsKt}
     * @utbot.methodUnderTest {@link DefaultArgumentsKt#foo(String, int, boolean)}
     */
    @Test
    @DisplayName("foo: arg_0 has special characters, number < 0, toUpperCase = true")
    public void testFooWithBlankString() {
        String actual = DefaultArgumentsKt.foo("\n\t\r", -1, true);

        String expected = "\n\t\r-1";
        assertEquals(expected, actual);
    }

image

image

Environment

Windows 10 Pro
IntelliJ IDEA 2022.2.3
Gradle project with JDK 11

Additional context

Not reproducing in IDEA 2022.1.4 (links are resolved):

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-summariesSomething related to the method names, code comments and display names generationctg-enhancementNew feature, improvement or change requestlang-kotlinIssue is related to Kotlin language support

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions