java - Is it possible to mock classes in webapp running within embedded Tomcat? -


i able mock class used webapp in junit test running embedded tomcat.

public interface foo {     void bar(); }  @runwith(jmockit.class) public class integrationtest {      @test     public void mockingfoo(@capturing final foo foo)             throws servletexception, lifecycleexception {          new expectations() {{             foo.bar(); result = new runtimeexception();         }};          final tomcat tomcat = new tomcat();          // myapp invoke foo instance         tomcat.addwebapp("/myapp", "/path/to/myapp.war");          tomcat.start();          /*          invoke webapp (via selenium, example)         call foo::bar in webapp should throw runtime exception          */          tomcat.stop();     } } 

what can done foo instances within webapp mocked via jmockit?

update - 20150821

i don't yet know answer question. however, managed mock classes in webapp running within jetty.


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -