-
Notifications
You must be signed in to change notification settings - Fork 45
Closed as not planned
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugstatus-wont-fixThis will not be worked onThis will not be worked on
Milestone
Description
Description
Generated tests for ClassWithComplicatedMethods use UtUtils method createInstance,
while there are public constructors.
To Reproduce
- Install UnitTestBot -IU- plugin built from main in IntelliJ IDEA
- Open
utbot-samplemodule inUTBotJavaproject - Generate tests for
ClassWithComplicatedMethods - Find
createInstancecalls in generated tests
Expected behavior
ClassWithComplicatedMethods has public constructors with a and b parameters.
Is it expected that they are used? Only a is used in path constraints.
Actual behavior
createInstance is called in all tests generated with Symbolic execution
Screenshots, logs
///region SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method applyMethodWithSideEffectAndReturn(int)
/**
* @utbot.classUnderTest {@link ClassWithComplicatedMethods}
* @utbot.methodUnderTest {@link ClassWithComplicatedMethods#applyMethodWithSideEffectAndReturn(int)}
* @utbot.executesCondition {@code (a == 2821): False}
* @utbot.invokes org.utbot.examples.make.symbolic.ClassWithComplicatedMethods#methodWithSideEffect(int)
*/
@Test
@DisplayName("applyMethodWithSideEffectAndReturn: ClassWithComplicatedMethodsMethodWithSideEffect -> return this")
public void testApplyMethodWithSideEffectAndReturn_ANotEquals2821() throws Exception {
ClassWithComplicatedMethods classWithComplicatedMethods = ((ClassWithComplicatedMethods) createInstance("org.utbot.examples.make.symbolic.ClassWithComplicatedMethods"));
classWithComplicatedMethods.a = 15;
ClassWithComplicatedMethods actual = classWithComplicatedMethods.applyMethodWithSideEffectAndReturn(1);
int classWithComplicatedMethodsA = classWithComplicatedMethods.a;
int actualA = actual.a;
assertEquals(classWithComplicatedMethodsA, actualA);
int finalClassWithComplicatedMethodsA = classWithComplicatedMethods.a;
assertEquals(2821, finalClassWithComplicatedMethodsA);
}
///endregionEnvironment
IntelliJ IDEA version - Ultimate 2023.2
Project - Gradle
JDK - 17
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugstatus-wont-fixThis will not be worked onThis will not be worked on
Type
Projects
Status
Done