Skip to content

Bad static method mocking #1128

Description

@SBOne-Kenobi

Description

Concrete Executor wrongly mocks static methods from different classes but with same signatures.

To Reproduce

Steps to reproduce the behavior:

publicclassAlsoRandom {
publicstaticintnext() {
return -42;
}
publicstaticintfoo() {
return1;
}
}
publicclassRandom {
publicstaticintnext() {
return42;
}
publicstaticintfoo() {
return0;
}
}
publicclassRandomUsage {
publicstaticintusage() {
intvalue = Random.next();
inta = Random.foo();
intb = AlsoRandom.foo();
if (value > 50) {
returna + b;
}
returnAlsoRandom.next() - value;
}
}
  1. Write some classes described above in new java project in IntelliJ Idea
  2. Use plugin to generate tests
  3. Run the generated test

Expected behavior

Tests are passed.

Actual behavior

Tests are failed.

Environment

Mocking static methods from another class.

Metadata

Metadata

Assignees

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