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

Cannot save tests generation report: error occurred 'List is empty., reason: java.util.NoSuchElementException #1098

Closed
Tracked by #1187
tyuldashev opened this issue Oct 5, 2022 · 3 comments
Assignees
Labels
ctg-bug Issue is a bug

Comments

@tyuldashev
Copy link
Collaborator

tyuldashev commented Oct 5, 2022

Description

When tests are not generated stacktrace shown instead of user friendly message.

To Reproduce
IDEA: 2022.2.2
UTBot: build 2022.10.395
Steps to reproduce the behavior:

  1. Open org.utbot.examples.algorithms.Graph from UTBot Java project
  2. Try to generate tests with Test generation timeout set to 1 s
  3. When first dialog Failed to generate unit tests for class Graph opened, click 'OK'

Expected behavior

Actual behavior

  • Empty test class created
  • User gets dialog which contains stacktrace:
    image
Cannot save tests generation report: error occurred 'List is empty., reason: java.util.NoSuchElementException: List is empty. 
at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:214) 
at org.utbot.framework.process.EngineMainKt$setup$10.invoke(EngineMain.kt:215) 
at org.utbot.framework.process.EngineMainKt$setup$10.invoke(EngineMain.kt:186) 
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$2$1$1.invoke(ClientProcessUtil.kt:79) 
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1.invokeSuspend(ClientProcessUtil.kt:69) 
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) 
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) 
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) 
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) 
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) 
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) 
at org.utbot.rd.CallsSynchronizer.measureExecutionForTermination(ClientProcessUtil.kt:66) 
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$2$1.invokeSuspend(ClientProcessUtil.kt:78) 
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) 
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) 
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) 
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) 
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) 
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) 
at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$2.invoke(ClientProcessUtil.kt:77) 
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.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
at java.lang.Thread.run(Thread.java:750) 

Additional context
Current behavior in release branch described in #980, where both dialogs shown.

@tyuldashev tyuldashev added the ctg-bug Issue is a bug label Oct 5, 2022
@tyuldashev tyuldashev moved this to Todo in UTBot Java Oct 5, 2022
@alisevych alisevych assigned mmvpm and unassigned Domonion Oct 5, 2022
@alisevych
Copy link
Member

The same is for the following code - with Timeout generation 1 sec:

public class CheckStatic {

    public final static Integer keyValue = 420;

    public static int check() {
        if (keyValue == 0) {
            return keyValue;
        } else {
            return -keyValue;
        }
    }

}

mmvpm added a commit that referenced this issue Oct 12, 2022
@mmvpm mmvpm moved this from Todo to In Progress in UTBot Java Oct 13, 2022
@mmvpm mmvpm moved this from In Progress to Done in UTBot Java Oct 19, 2022
@mmvpm
Copy link
Collaborator

mmvpm commented Oct 19, 2022

PR-1164 fixes this issue

@mmvpm mmvpm closed this as completed Oct 19, 2022
@alisevych
Copy link
Member

Verified on latest build from main
Not reproducing
Checked on Gradle projects with JDK 11 and 17, Maven project with JDK 13

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