-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bug
Description
Description
When generating parametrized test for Graph
class there are two opposite asserts appears in one of the tests: assertNotNull
and assertNull
.
To Reproduce
Steps to reproduce the behavior:
- Open the 'UTBot Java' project in IntelliJ Idea
- Use plugin to generate parametrized tests for
org.utbot.examples.algorithms.Graph#getAdj
. No matter if it's JUnit5 or TestNG. - Open the generated test
Expected behavior
Generated test would looks something like that. One assert type in each if/else
branch
@ParameterizedTest
@MethodSource("org.utbot.examples.algorithms.GraphTest#provideDataForGetAdj")
public void parameterizedTestsForGetAdj(Graph graph, int[][] expectedResult) {
int[][] actual = graph.getAdj();
if (expectedResult == null) {
assertNull(actual);
} else {
assertNotNull(actual);
}
}
Actual behavior
Please note that else
branch contains two opposite assertions.
@ParameterizedTest
@MethodSource("org.utbot.examples.algorithms.GraphTest#provideDataForGetAdj")
public void parameterizedTestsForGetAdj(Graph graph, int[][] expectedResult) {
int[][] actual = graph.getAdj();
if (expectedResult == null) {
assertNull(actual);
} else {
assertNotNull(actual);
assertNull(actual);
}
}
Additional context
The problem is pre-existing, it also exists in 2022.2.5.
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bug
Type
Projects
Status
Todo