From: Bryce F. <br...@be...> - 2004-01-07 01:56:12
|
Noob here.=20 Having a problem with getting dynamocks to work. I must be missing something important here. I'm getting the followin assertion failure: junit.framework.AssertionFailedError: mockSecurityManagerDelegate: validate= Login() was expected but not called at com.mockobjects.dynamic.Mock.verify(Mock.java:107) at com.berzerkersoft.bisweb.web.services.ValidateLoginTest.tearDown(Valida= teLoginTest.java:42) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT= estRunner.java:395) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu= nner.java:279) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR= unner.java:171) Here's my Test Code: public void testSuccessfulLogin() { mockSecurityManager.expectAndReturn("validateLogin", true); =09 setRequestPathInfo("/validateLogin"); addRequestParameter("username", "bryce"); addRequestParameter("password", "bryce"); getRequest().setAttribute(SecurityManagerDelegate.class.getName(), securi= tyManager); =09 actionPerform(); =09 verifyForward("success"); } and here's the call my class is making: =2E.. =2E.. if (manager.validateLogin(username, password)) { actionForward =3D mapping.findForward(FORWARD_loginSuccessful); =2E.. =2E.. I thought that calling expectAndReturn without any contstraint matchers would accept any call regardless.. Maybe I'm wrong. Hopefully someone can set me right. TIA. --=20 Bryce Fischer <br...@be...> |