When executing my own test I encounter a problem saying
"java.lang.IllegalStateException: missing behavior definition for the
preceeding method call getRemoteHost()." The example I follow to do my test
is DefaultWebSecurityManagerTest.java. What I want to do is to test login
after web env setup. The steps I use is as follow:
request = createNiceMock(HttpServletRequest.class);
response = createNiceMock(HttpServletResponse.class);
WebUtils.bindInetAddressToThread(request);
expect(this.request.getRemoteHost()).andReturn(null); // error
goes wrong
here
WebUtils.bind(request);
WebUtils.bind(response);
ThreadContext.bind(securityManager);// security manager already
been setup
ThreadContext.bind(securityManager.getSubject());
I've checking the output of WebUtils.java that the method getInetAddress
does exactly return null value. So I am a bit confused what extra steps do I
need to configure to setup mock web environment?
stacktrace is as below:
java.lang.IllegalStateException: missing behavior definition for the
preceeding method call getRemoteHost()
at
org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:30)
at
org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:61)
at $Proxy15.getRemoteHost(Unknown Source)
at sample.web.MockWebEnvironment.bind(MockWebEnvironment.java:25)
at
sample.security.shiro.SecurityServiceTest.setUp(SecurityServiceTest.java:47)
--
View this message in context:
http://n2.nabble.com/java-lang-IllegalStateException-missing-behavior-definition-for-the-preceeding-method-call-getRemote-tp3617074p3617074.html
Sent from the Shiro User mailing list archive at Nabble.com.