meishild
unread,Sep 16, 2011, 3:13:47 AM9/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gmock-user, johnny...@gmail.com
public class NumberUtils {
public static int toInt(String str) {
if (str == null) {
return 0;
}
try {
return Integer.parseInt(str);
} catch (Exception e) {
return 0;
}
}
public static int toInt() {
Random random = new Random();
return random.nextInt();
}
}
def void testGetInteger(){
def number = new Number()
mock(NumberUtils).static.toInt("123").returns(2)
play{
assert 2 == number.getInteger("123")
}
}
I want mock the toInt static method ,but use gmock,I can't do it