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

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -