Created
January 22, 2013 07:57
-
-
Save Teqqles/4592889 to your computer and use it in GitHub Desktop.
Creating and asserting a mocked interface with MockFor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def expected = "text/plain"; | |
mock = new MockFor( HttpServletResponse.class ); | |
mock.demand.with { | |
setContentType{ String got -> assert expected == got } | |
} | |
def mockHttpServletResponse = mock.proxyInstance(); | |
def themeWriter = new ThemeWriter( mockHttpServletResponse ); | |
themeWriter.generateResponse(); | |
mock.verify( mockHttpServletResponse ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment