Skip to content

Empty true branch in generated parametrized test #683

Closed
@sofurihafe

Description

@sofurihafe

Description

Generated parametrized test has empty true branch body.

To Reproduce

  1. Enable parametrized test generation mode,
  2. Run testMockInterfaceWithoutImplementors test.

Actual behavior
True branch is empty, but there must be an assertion.

public class CommonMocksExampleGeneratedTest {
    ///region Test suites for executable org.utbot.examples.mock.CommonMocksExample.mockInterfaceWithoutImplementors
    
    ///region Parameterized test for method mockInterfaceWithoutImplementors(org.utbot.examples.mock.InterfaceWithoutImplementors)
    
    @ParameterizedTest
    @MethodSource("provideDataForMockInterfaceWithoutImplementors")
    public void parameterizedTestsForMockInterfaceWithoutImplementors(CommonMocksExample commonMocksExample,
    InterfaceWithoutImplementors interfaceWithoutImplementors,
    Object expectedResult,
    Class expectedError
    ) {
        try {
            Object actual = commonMocksExample.mockInterfaceWithoutImplementors(interfaceWithoutImplementors);
            
            if (expectedResult == null) {
            } else {
                assertNull(actual);
            }
        } catch (java.lang.Throwable throwable) {
            assertTrue(expectedError.isInstance(throwable));
        }
    }
    ///endregion
    
    ///endregion
    
    ///region Data providers and utils methods
    
    public static java.util.ArrayList provideDataForMockInterfaceWithoutImplementors() {
        <...>
    }
    ///endregion
}

Metadata

Metadata

Labels

comp-codegenIssue is related to code generatorctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions