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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -