You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version of JMockit that was used:
1.49 (also in master branch at 5c6a2df)
Description of the problem or enhancement request:
Consider this test scenario
public static class BaseClass {
protected int doSomething() { return 1; }
}
public static class Subclass extends BaseClass {
@Override protected int doSomething() { return super.doSomething() + 1; }
}
public static final class FakeForSubclass extends MockUp<Subclass> {
@Mock public int doSomething(Invocation inv) { return inv.proceed(); }
}
When a test uses FakeForSubclass and creates an instance of Subclass, calling subclass.doSomething() results in a StackOverflowError.
Initially the invocation proceeds to run the code on Subclass, which calls the method on the base class that it overrides.
This call is intercepted by FakeForSubclass, which calls the code in Subclass again, resulting in a loop that ends in the StackOverflowError. The code in BaseClassshould be called instead.
I created a pull request that adds a validation for this issue on the FakedClassWithSuperClassTest: #704
The text was updated successfully, but these errors were encountered:
Version of JMockit that was used:
1.49 (also in master branch at 5c6a2df)
Description of the problem or enhancement request:
Consider this test scenario
When a test uses
FakeForSubclass
and creates an instance ofSubclass
, callingsubclass.doSomething()
results in a StackOverflowError.Initially the invocation proceeds to run the code on
Subclass
, which calls the method on the base class that it overrides.This call is intercepted by
FakeForSubclass
, which calls the code inSubclass
again, resulting in a loop that ends in the StackOverflowError. The code inBaseClass
should be called instead.I created a pull request that adds a validation for this issue on the FakedClassWithSuperClassTest: #704
The text was updated successfully, but these errors were encountered: