java - Power Mockito test ServletOutputStream -
i trying test printed servlet output stream using power mockito can't find way it.
here have far
routing routingmock = powermockito.mock( routing.class ); httpservletrequest httprequestmock = powermockito.mock( httpservletrequest.class ); httpservletresponse httpservletresponsemock = powermockito.mock( httpservletresponse.class ); powermockito.when( httprequestmock.getpathinfo() ).thenreturn( "/users" ); servletoutputstream outputstreammock = powermockito.mock( servletoutputstream.class ); powermockito.when( httpservletresponsemock.getoutputstream() ).thenreturn( outputstream ); routingmock.doget( httprequestmock, httpservletresponsemock );
can me figure out how access data written outputstreammock?
thanks
as far know , experience power mockito. have fill in data in output stream , return it.
like in below statement, output stream; fill in data i.e. write needed data stream , return.
powermockito.when( httpservletresponsemock.getoutputstream() ).thenreturn( outputstream );
Comments
Post a Comment