google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

Field annotated with @Mock are not updated on multiple instantiations #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Declare a field with the @Mock annotation
2. Call GWT.create(ThatType.class)
3. Call GWT.create(ThatType.class) again

The field annotated with @Mock is not updated with the new instance of the 
object.

What version of the product are you using? On what operating system?
gwt-test-utils 0.41
gwt 2.4.0

Original issue reported on code.google.com by sarcidia...@instart.co on 18 Oct 2012 at 9:38

GoogleCodeExporter commented 9 years ago
No, I'm sorry, I take it back.
I just implemented a workaround and found that my problem is trickier than this.

My problem is that the field actually is reinitialized for each test, even 
GWT.create() is not called and a cached instance is used by the test.
This is expected behavior, right?

Original comment by sarcidia...@instart.co on 18 Oct 2012 at 9:45

GoogleCodeExporter commented 9 years ago
Yes, this is the expected behavior ;-)
There are @Before methods to do it in both GwtTestWithEasyMock and 
GwtTestWithMockito.

Original comment by gael.laz...@gmail.com on 19 Oct 2012 at 6:22