Skip to content

Test generation for an abstract class fails #873

Closed
@sergeypospelov

Description

@sergeypospelov

Description

If we run test generation for an abstract class, the dialog appears, but further test generation fails.

To Reproduce

Steps to reproduce the behavior:

  1. Create a Java project
  2. Paste this code:
abstract public class AbstractClass {
    int testMe(int x) {
        if (x == 0) {
            throw new IllegalStateException("123");
        }
        return 0;
    }
}
  1. Run "Create Tests with UtBot" action
  2. Doesn't matter mocks enabled or not
  3. Choose the single method and press "Generate Tests" button

Expected behavior

I see these possible behaviors:

  • Prohibit to generate tests for abstract classes completely, so action is disabled, if the caret context class is abstract
  • Prohibit to generate tests for abstract classes completely, so popup appears if the user tries to run the action for an abstract class
  • Allow to generate tests for abstract classes if mocks are enabled, and initialize an abstract class instance with mocks

Maybe there are better solutions.

Actual behavior

An error popup appears saying nothing about the class is abstract.

Visual proofs (screenshots, logs, images)

image

Metadata

Metadata

Labels

ctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions