Skip to content

String.join() with Enum.toString() inside - test generation fails #434

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

Closed
alisevych opened this issue Jul 6, 2022 · 1 comment
Closed
Labels
ctg-bug Issue is a bug

Comments

@alisevych
Copy link
Member

alisevych commented Jul 6, 2022

Description

Test generation fails for String.join() with Enum.toString() inside

To Reproduce

Steps to reproduce the behavior:

  1. IntelliJ IDEA with UTBotJava plugin installed
  2. A project with JDK 8/11 is opened
  3. Add the following class:
public class UsingEnum {

    public void execute() {
        String print = String.join("\n", 
                WorkDays.Monday.toString(), 
                WorkDays.Tuesday.toString());
    }

    public enum WorkDays {
        Monday,
        Tuesday,
        Wednesday,
        Thursday,
        Friday
    }
}
  1. Run Generating tests with UTBot... for this class

Expected behavior

Tests are supposed to be generated.

Actual behavior

"Failed to generate unit tests for class UsingEnum" error popup is shown in IDEA.
It is shown immediately after test generation is started.

Visual proofs (screenshots, logs, images)

String join with Enum toString()

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.3
checked on JDK 8 and 11, Gradle projects - same error

Additional context

Adding some input parameters to the method helps - fuzzer is generating tests.

@alisevych alisevych added the ctg-bug Issue is a bug label Jul 6, 2022
@alisevych alisevych moved this to Todo in UTBot Java Jul 6, 2022
@alisevych alisevych changed the title Test generation fails for String.join() with Enum.toString() inside String.join() with Enum.toString() inside - test generation fails Jul 6, 2022
@alisevych
Copy link
Member Author

The issue is NOT reproducing on the latest build - from here, with #425 fix

Repository owner moved this from Todo to Done in UTBot Java Jul 6, 2022
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

2 participants