title: Mocking vert.x application with PowerMockito
body: <p>I'm trying to test my verticle but with mocked MongoDB (not to perform real DB actions during the process of unit testing), I've tried to mock my client, but looks like when I use <code>vertx.deployVerticle()</code> my mocks are not being taken into account.</p>
  
  <p>Here's an example of my test setup:</p>
  
  <pre><code>@RunWith(VertxUnitRunner.class)
  @PrepareForTest({ MongoClient.class })
  public class VerticleTest {
    @Rule
    public PowerMockRule rule = new PowerMockRule();
    private Vertx vertx;
    private Integer port;
  
    @Before
    public void setUp(TestContext context) throws Exception {
      vertx = Vertx.vertx();
  
      mockStatic(MongoClient.class);
  
      MongoClient mongo = Mockito.mock(MongoClientImpl.class);
      when(MongoClient.createShared(any(), any())).thenReturn(mongo);
  
      ServerSocket socket = new ServerSocket(0);
      port = socket.getLocalPort();
      socket.close();
  
      DeploymentOptions options = new DeploymentOptions().setConfig(new JsonObject().put("http.port", port));
      vertx.deployVerticle(TalWebVerticle.class.getName(), options, context.asyncAssertSuccess());
    }
  </code></pre>
  
  <p>And what I actually see, that is that <code>MongoClient.createShared</code> is still being called, though I've mocked it.<br>
  What can I do in this case?</p>
  
  <p><strong>Edit 1.</strong><br>
  Looks like the problem is that <code>MongoClient</code> is an <strong>interface</strong> and <strong>PowerMockito</strong> is not able to mock static methods in this case.<br>
  I'm still trying to find workaround for this case.</p>