Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UtUtils class is not generated with the first UTBot test generation #879

Closed
alisevych opened this issue Sep 8, 2022 · 4 comments
Closed
Assignees
Labels
ctg-bug Issue is a bug

Comments

@alisevych
Copy link
Member

alisevych commented Sep 8, 2022

Description

UtUtils.deepEquals is used in generated CommonMocksExampleTest but not created.
Second UTBot execution generated UtUtils class.

To Reproduce

Steps to reproduce the behavior:

  1. Open the utbot-sample/src/main/java/org/utbot/examples/mock/CommonMocksExample.java file
  2. Generate tests in utbot-sample test source root
    with "Other packages: Mockito" and "Mockito static mocking" options
  3. Open the generated test

Expected behavior

UtUtils class is supposed to be generated when used.

Actual behavior

UtUtils class is missed.
Import UtUtils.deepEquals is not found.
Tests are not compiling.
Second test generation for the same class creates UtUtils class.

Visual proofs (screenshots, logs, images)

There is the following strings in the generated test class:

import static org.utbot.runtime.utils.UtUtils.deepEquals;

    @Test
    @DisplayName("nextValue: node.next == node : True -> return node")
    public void testNextValue_NodeNextEqualsNode() {
        CommonMocksExample commonMocksExample = new CommonMocksExample();
        RecursiveTypeClass nodeMock = mock(RecursiveTypeClass.class);
        nodeMock.next = nodeMock;

        RecursiveTypeClass actual = commonMocksExample.nextValue(nodeMock);

        assertTrue(deepEquals(nodeMock, actual));
        int nodeMockValue = nodeMock.value;
        int actualValue = actual.value;
        assertEquals(nodeMockValue, actualValue);

    }

image

Environment

Windows 10 Pro
UTBotJava project
JDK 11 is used

Additional context

Same for code when UtUtils.createInstance is used in the generated test.

@korifey korifey moved this to Todo in UTBot Java Sep 8, 2022
@alisevych alisevych changed the title UtUtils.deepEquals is used in generated test when not created UtUtils.deepEquals is used in generated test but not created Sep 8, 2022
@alisevych alisevych changed the title UtUtils.deepEquals is used in generated test but not created UtUtils class is not generated with the first UTBot test generation Sep 8, 2022
@alisevych alisevych added the ctg-bug Issue is a bug label Sep 8, 2022
@alisevych alisevych assigned ArsenHD and unassigned denis-fokin Sep 8, 2022
@alisevych alisevych added this to the Release preparation milestone Sep 8, 2022
@alisevych
Copy link
Member Author

This bug depends on #709

@Vassiliy-Kudryashov
Copy link
Member

The issue seems to be obsolete now

@alisevych
Copy link
Member Author

@Vassiliy-Kudryashov Thank you! Will check on different cases.

@alisevych
Copy link
Member Author

Fixed with #709

@alisevych alisevych closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2022
Repository owner moved this from Todo to Done in UTBot Java Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug Issue is a bug
Projects
Archived in project
Development

No branches or pull requests

4 participants