easyforgood / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Upgrading to mockito-all-1.9.5-rc1.jar and replacing stub with when issue. #378

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello. 

I have replaced the Mockito jar file with the latest 1.9.5 and then replaced 
the following 

  import static org.mockito.Mockito.stub; 
with
  import static org.mockito.Mockito.when;

and all the 
  stub(...).toReturn(...);
with 
  when(...).thenReturn(..);

Then the rebuild get the following errors. 

cannot find symbol
 [javac] symbol  : static when
 [javac] location: class org.mockito.Mockito
 [javac] import static org.mockito.Mockito.when;
 [javac] ^

However, if I replace 
  import static org.mockito.Mockito.when;
with 
  import static org.mockito.Mockito.*;

The build completes Ok.  

I'm told using .* on imports is not good coding practice. Any idea why this is 
tripping me up. 

Thanks. 

Original issue reported on code.google.com by salon2...@gmail.com on 17 Sep 2012 at 9:12

GoogleCodeExporter commented 8 years ago
This error can only happen with an erroneous classpath. Maybe your ant build 
script still references an old mockito jar.

Original comment by brice.du...@gmail.com on 17 Sep 2012 at 10:01

GoogleCodeExporter commented 8 years ago
I'll invalidate this issue, as it doesn't seem to be a mockito related issue. 
If you think otherwise let me know.

Cheers
Brice

Original comment by brice.du...@gmail.com on 27 Sep 2012 at 2:25