Skip to content

Conversation

@sofurihafe
Copy link
Member

Description

Choosing a different package as a test source root may lead to unnecessary repeating imports being rendered. The cause was that formatter was able to add extra imports when there was a method (which is from a different package) invocation. This PR fixes prohibits such behavior.

Fixes # (1286)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Automated Testing

utbot-samples.

Manual Scenario

Open UTBotJava project, generate tests for the org.utbot.examples.exceptions.ExceptionExamples class choosing different package as a test source root location. Verify that the generated code has no repeating imports as it was described in the issue:

package org.utbot.examples.exceptions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.utbot.runtime.utils.java.UtUtils.createInstance; public final class ExceptionExamplesTest { <...> }
@sofurihafe sofurihafe linked an issue Nov 22, 2022 that may be closed by this pull request
@EgorkaKulikov EgorkaKulikov enabled auto-merge (squash) November 22, 2022 13:03
@EgorkaKulikov EgorkaKulikov merged commit 95d6cb0 into main Nov 22, 2022
@EgorkaKulikov EgorkaKulikov deleted the andrey-t/repeating-imports branch November 22, 2022 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants