Skip to content

Uncompilable test for inner class, due improper naming #2515

Closed
@tyuldashev

Description

@tyuldashev

Description
When generate test for nested class its generated with name like this Outer_InnerTest while file name is InnerTest.java, which makes is uncompilable.

To Reproduce

  1. Install UnitTestBot plugin built from main in IntelliJ IDEA
  2. Add code sample shown below.
  3. Set caret inside Inner class.
  4. Invoke test generation.
class Outer {
    public static class Inner {
          public int f() {
              return 0;
          } // put  caret here
    }
}

Expected behavior
Generated tests could be executed.

Actual behavior
Generated test public final class Outer_InnerTest {... is inside file InnerTest.java and fails during compilation.

Additional context
Same problem for fuzzing/symbolic, pre-existing in 2023.3 plugin version.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions