UTBotJava icon indicating copy to clipboard operation
UTBotJava copied to clipboard

Import assertTrue is missing

Open alisevych opened this issue 2 years ago • 1 comments

Description

Junit5 assertTrue is used, but import is missing

To Reproduce

  1. Install UnitTestBot plugin built from main in IntelliJ IDEA
  2. Open sm***t project
  3. Generate Unit tests with No configuration tests for Facet
  4. Check generated test

Expected behavior

Generated test should have import of used asserts.

Actual behavior

Generated test is not compiling, assertTrue import is missing.

Screenshots, logs

The following imports are present:

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.utbot.runtime.utils.java.UtUtils.deepEquals;

The following line is present in generated test, that is not compiling:

        assertTrue(deepEquals(arrayList, actual));

Environment

IntelliJ IDEA version - 2023.2 Ultimate Project - Maven JDK - 1.8

alisevych avatar Sep 22 '23 08:09 alisevych

Seems that the problem is in the imports optimizer we currently use. May be we should think about another one.

EgorkaKulikov avatar Dec 13 '23 13:12 EgorkaKulikov