-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Mock annotation from easymock api does not work for two fields of the same type. #755
Comments
I've found out that org.powermock.api.easymock.annotation.Mock has a new property called fieldName that solves the problem. However with that additional configuration:
What makes you introduce that feature? Is it documented somewhere? |
A new fields has been added to fit behaviour of EasyMock and |
Hi @thekingnothing, I've checked and it does not change anything. Moreover I almost changed all places in our codes but reached one with org.powermock.api.easymock.annotation.MockNice annotation that is also affected but does not have fieldName to be set. Regards, Karol. |
Hi,
if we have a simple test class like below
then both assertions fail. We noticed that whenever two fields of the same type are annotated with
org.powermock.api.easymock.annotation.Mock
If we remove first one or change to
private String obj1 = createMock(String.class);
then it works as expected. We encountered that when migrating from
jdk7 + easymock 3.3 + powermock 1.6.1
to
jdk8 + easymock 3.4 + powermock 1.6.6
OS is: Linux *** 4.4.0-62-generic 83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Does any workaround exist besides replacing annotation with
org.powermock.api.easymock.PowerMock.createMock()
?
UPDATE: it seems to be similar to #668 but I checked and it works for a third field as long as it has different type (I checked for 3 fields - 2 x String and 1 x Integer - and strings do not work but integer does).
The text was updated successfully, but these errors were encountered: