on-internet
← Community

Mocking a method based on the parameter in Spock

Stack Overflow ·

Im trying to figure out mocking and for some reason it keeps returning the correct answer (win) not the one i want it to return (mac) /** * This is an empty imple class. Its intention is to allow operating * system specific information to be mocked for unit testing. */ class OsImpl extends Os { } /** * A utility convenience class that helps with pulling a variety of machine information for the build system */ class ProjectInfo { static String operatingSystem(){ operatingSystem(new OsImpl()) } /** * Returns a 3 char code on the operating system of the local machine. * @return String Code ['win'

Comments

Sign in or sign up to comment and upvote.

No comments yet.