Skip to content

ArrayList.toString() - fails to generate tests  #391

Closed
@alisevych

Description

@alisevych

Description

Presence of ArrayList.toString() method leads to test generation failure.

To Reproduce

Steps to reproduce the behavior:

  1. Open IntelliJ IDEA
  2. Plugin is installed
  3. A project with JDK 8/11 is opened
  4. Add a class using ArrayList.toString() method, like:
public class ListToStringExample {

    public void toStringList() {
        Arrays.asList("a", "b", "c").toString();
    }
}

Expected behavior

Tests should be successfully generated

Actual behavior

Failed to generate unit tests... popup is shown.
Timeout increasing is suggested, but that doesn't help.
Failure is displayed in 2-3 seconds , timeout is not reached.

Visual proofs (screenshots, logs, images)

ListToString failed

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.3
JDK 8, 11

Additional context

Same AbstractCollection.toString() implementation is called for this code - same error is displayed:

public class ListToStringExample {

    public void toStringList() {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.toString();
    }
}

ListToString failed 2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions