Skip to content

@utbot.invokes in Javadoc for ExceptionExamples contains full path instead of short class name #1872

Open
@alisevych

Description

@alisevych

Description

@utbot.invokes in Javadoc for ExceptionExamples contains full path to the class.
Other tags contain just short class name.

To Reproduce

  1. Run the 'utbot' project in IntelliJ Idea 2022.1-2.*
  2. Install plugin built from main - utbot-intellij-* artefact from this run was used
  3. Use default settings (custom Javadoc style)
  4. Generate tests for ExceptionExamples sample
  5. Open the generated test

Expected behavior

  1. @utbot.invokes should contain short class names.
    Needed classes are imported.

  2. do we need all implicit invocations, like StringBuilder in the second example below ?

Actual behavior

@utbot.invokes with user methods' invocations calls contain full paths to the methods.

Visual proofs (screenshots, logs, images)

    ///region SYMBOLIC EXECUTION: EXPLICITLY THROWN UNCHECKED EXCEPTIONS for method doNotCatchNested(int)

    /**
     * @utbot.classUnderTest {@link ExceptionExamples}
     * @utbot.methodUnderTest {@link ExceptionExamples#doNotCatchNested(int)}
     * @utbot.executesCondition {@code (i < 0): False}
     * @utbot.invokes org.utbot.examples.exceptions.ExceptionExamples#checkAll(int)
     * @utbot.invokes org.utbot.examples.exceptions.ExceptionExamples#checkPositive(int)
     * @utbot.invokes org.utbot.examples.exceptions.ExceptionExamples#checkPositive(int)
     * @utbot.throwsException {@link NullPointerException} in: return checkAll(i);
     */
    @Test
    @DisplayName("doNotCatchNested: return checkAll(i) : True -> ThrowNullPointerException")
    public void testDoNotCatchNested_IGreaterOrEqualZero_1() {
        ExceptionExamples exceptionExamples = new ExceptionExamples();

        assertThrows(NullPointerException.class, () -> exceptionExamples.doNotCatchNested(1));
    }

    ///region SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method createException()

    /**
     * @utbot.classUnderTest {@link ExceptionExamples}
     * @utbot.methodUnderTest {@link ExceptionExamples#createException()}
     * @utbot.invokes {@link StringBuilder#append(String)}
     * @utbot.invokes {@link Math#sqrt(double)}
     * @utbot.invokes {@link StringBuilder#append(double)}
     * @utbot.invokes {@link StringBuilder#toString()}
     * @utbot.returnsFrom {@code return new IllegalArgumentException("Here we are: " + Math.sqrt(10));}
     */
    @Test
    @DisplayName("createException: StringBuilderAppend -> return new IllegalArgumentException(\"Here we are: \" + Math.sqrt(10))")
    public void testCreateException_StringBuilderToString() throws Exception {
        ExceptionExamples exceptionExamples = new ExceptionExamples();

        IllegalArgumentException actual = exceptionExamples.createException();

        IllegalArgumentException expected = ((IllegalArgumentException) createInstance("java.lang.IllegalArgumentException"));
    }
    ///endregion

Environment

IntelliJ IDEA 2022.2
Gradle, JDK 11

Additional context

Other tags contain short class names.
@utbot.invoked with library methods' calls contain short names.

Metadata

Metadata

Labels

comp-summariesSomething related to the method names, code comments and display names generationctg-bugIssue is a buglang-javaIssue is related to Java support

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions