You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error in Fuzzing test generation for code producing Function<String, Integer> #1419
An error test is generated with information about errors in the concrete executor: Array has more than one element
No exceptions are present in concrete executor log , RD engine logs, idea.log
Only one about failed to save test report.
Visual proofs (screenshots, logs, images)
importjava.util.function.Function;
publicfinalclassLambdaTest {
///region Test suites for executable org.utbot.examples.lambda.Lambda.returnLambda///region Errors report for returnLambdapublicvoidtestReturnLambda_errors() {
// Couldn't generate some tests. List of errors:// // 1 occurrences of:// Array has more than one element.
}
///endregion///endregion
}
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.3
Gradle , JDK 11
Additional context
IF Symbolic execution is turned on - a successful test is generated besides the error on.
Looks like the problem is caused by this change cc @SBOne-Kenobi . The stracktrace of the error is:
java.lang.IllegalArgumentException: Array has more than one element.
at kotlin.collections.ArraysKt___ArraysKt.single(_Arrays.kt:2812)
at org.utbot.framework.plugin.api.UtLambdaModel.getLambdaMethodId(Api.kt:578)
at org.utbot.framework.codegen.tree.CgVariableConstructor.constructLambda(CgVariableConstructor.kt:127)
at org.utbot.framework.codegen.tree.CgVariableConstructor.getOrCreateVariable(CgVariableConstructor.kt:113)
at org.utbot.framework.codegen.tree.CgMethodConstructor.generateResultAssertions(CgMethodConstructor.kt:316)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1$2$mainBody$1.invoke(CgMethodConstructor.kt:1390)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1$2$mainBody$1.invoke(CgMethodConstructor.kt:1370)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1$2.invoke(CgMethodConstructor.kt:1407)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1$2.invoke(CgMethodConstructor.kt:1363)
at org.utbot.framework.codegen.domain.context.CgContextOwner$block$1.invoke(CgContext.kt:231)
at org.utbot.framework.codegen.domain.context.CgContextOwner$block$1.invoke(CgContext.kt:230)
at org.utbot.framework.codegen.domain.context.CgContextOwner$DefaultImpls.withNameScope(CgContext.kt:323)
at org.utbot.framework.codegen.domain.context.CgContext.withNameScope(CgContext.kt:432)
at org.utbot.framework.codegen.domain.context.CgContextOwner$DefaultImpls.block(CgContext.kt:230)
at org.utbot.framework.codegen.domain.context.CgContext.block(CgContext.kt:432)
at org.utbot.framework.codegen.tree.CgMethodConstructor.block(CgMethodConstructor.kt)
at org.utbot.framework.codegen.tree.CgMethodConstructor$testMethod$testMethod$1.invoke(CgMethodConstructor.kt:1846)
at org.utbot.framework.codegen.tree.CgMethodConstructor$testMethod$testMethod$1.invoke(CgMethodConstructor.kt:1843)
at org.utbot.framework.codegen.tree.BuildersKt.buildTestMethod(Builders.kt:108)
at org.utbot.framework.codegen.tree.CgMethodConstructor.testMethod(CgMethodConstructor.kt:1843)
at org.utbot.framework.codegen.tree.CgMethodConstructor.testMethod$default(CgMethodConstructor.kt:1802)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1.invoke(CgMethodConstructor.kt:1363)
at org.utbot.framework.codegen.tree.CgMethodConstructor$createTestMethod$1.invoke(CgMethodConstructor.kt:1356)
at org.utbot.framework.codegen.tree.CgMethodConstructor.withTestMethodScope(CgMethodConstructor.kt:1717)
at org.utbot.framework.codegen.tree.CgMethodConstructor.createTestMethod(CgMethodConstructor.kt:1356)
at org.utbot.framework.codegen.tree.CgTestClassConstructor.createTest(CgTestClassConstructor.kt:188)
at org.utbot.framework.codegen.tree.CgTestClassConstructor.constructTestSet(CgTestClassConstructor.kt:148)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$constructTestClass$1$3.invoke(CgTestClassConstructor.kt:98)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$constructTestClass$1$3.invoke(CgTestClassConstructor.kt:86)
at org.utbot.framework.codegen.tree.BuildersKt.buildClassBody(Builders.kt:73)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$constructTestClass$1.invoke(CgTestClassConstructor.kt:86)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$constructTestClass$1.invoke(CgTestClassConstructor.kt:70)
at org.utbot.framework.codegen.tree.BuildersKt.buildClass(Builders.kt:63)
at org.utbot.framework.codegen.tree.CgTestClassConstructor.constructTestClass(CgTestClassConstructor.kt:70)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$construct$1$1.invoke(CgTestClassConstructor.kt:64)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$construct$1$1.invoke(CgTestClassConstructor.kt:64)
at org.utbot.framework.codegen.domain.context.CgContext.withTestClassScope(CgContext.kt:535)
at org.utbot.framework.codegen.tree.CgTestClassConstructor.withTestClassScope(CgTestClassConstructor.kt)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$construct$1.invoke(CgTestClassConstructor.kt:64)
at org.utbot.framework.codegen.tree.CgTestClassConstructor$construct$1.invoke(CgTestClassConstructor.kt:63)
at org.utbot.framework.codegen.tree.BuildersKt.buildClassFile(Builders.kt:48)
at org.utbot.framework.codegen.tree.CgTestClassConstructor.construct(CgTestClassConstructor.kt:63)
at org.utbot.framework.codegen.CodeGenerator$generateAsStringWithTestReport$1$1.invoke(CodeGenerator.kt:74)
at org.utbot.framework.codegen.CodeGenerator$generateAsStringWithTestReport$1$1.invoke(CodeGenerator.kt:69)
at org.utbot.framework.codegen.domain.context.CgContext.withTestClassFileScope(CgContext.kt:525)
at org.utbot.framework.codegen.CodeGenerator$generateAsStringWithTestReport$1.invoke(CodeGenerator.kt:69)
at org.utbot.framework.codegen.CodeGenerator$generateAsStringWithTestReport$1.invoke(CodeGenerator.kt:68)
at org.utbot.framework.codegen.CodeGenerator.withCustomContext(CodeGenerator.kt:98)
at org.utbot.framework.codegen.CodeGenerator.generateAsStringWithTestReport(CodeGenerator.kt:68)
at org.utbot.framework.codegen.CodeGenerator.generateAsStringWithTestReport$default(CodeGenerator.kt:63)
at org.utbot.framework.process.EngineMainKt$setup$4.invoke(EngineMain.kt:154)
at org.utbot.framework.process.EngineMainKt$setup$4.invoke(EngineMain.kt:129)
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1$1.invoke(ClientProcessUtil.kt:84)
at org.utbot.rd.CallsSynchronizer.measureExecutionForTermination(ClientProcessUtil.kt:75)
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1.invoke(ClientProcessUtil.kt:83)
at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360)
at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57)
at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56)
at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148)
at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56)
at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54)
at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase.queue$lambda-3(SingleThreadScheduler.kt:41)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
The problem is that functional interface has not only one abstract function but also can have default and static methods. For this case they are:
public abstract java.lang.Object java.util.function.Function.apply(java.lang.Object)
public static java.util.function.Function java.util.function.Function.identity()
public default java.util.function.Function java.util.function.Function.compose(java.util.function.Function)
public default java.util.function.Function java.util.function.Function.andThen(java.util.function.Function)
private static java.lang.Object java.util.function.Function.lambda$identity$2(java.lang.Object)
private java.lang.Object java.util.function.Function.lambda$andThen$1(java.util.function.Function,java.lang.Object)
private java.lang.Object java.util.function.Function.lambda$compose$0(java.util.function.Function,java.lang.Object)
Also, the issue is very hard to identify until CgTestClassConstructor#processFailure(testSet: CgMethodTestSet, failure: Throwable) just consumes an exception without any additional log printing. @sofurihafe Please, consider to add some error log printing.
Activity
Markoutte commentedon Nov 25, 2022
Looks like the problem is caused by this change cc @SBOne-Kenobi . The stracktrace of the error is:
The problem is that functional interface has not only one abstract function but also can have default and static methods. For this case they are:
Also, the issue is very hard to identify until CgTestClassConstructor#processFailure(testSet: CgMethodTestSet, failure: Throwable) just consumes an exception without any additional log printing. @sofurihafe Please, consider to add some error log printing.