@Test
  public void ensureAlreadyCommitedResponsesSafelyExit() throws Exception {
    doReturn(true).when(response).isCommitted();

    filter.doFilter(request, response, chain);
    verify(scope, VerificationModeFactory.noMoreInteractions()).enter();
  }
  @Test
  public void should_not_create_db_if_already_exists() {
    when(httpClient.head("/test_db/"))
        .thenReturn(
            HttpResponseStub.valueOf(
                200,
                "{\"test_db\":\"global\",\"doc_count\":1,\"doc_del_count\":0,\"update_seq\":3,\"purge_seq\":0,\"compact_running\":false,\"disk_size\":100,\"instance_start_time\":\"130\",\"disk_format_version\":5,\"committed_update_seq\":3}"));

    dbCon.createDatabaseIfNotExists();
    verify(httpClient, VerificationModeFactory.times(0)).put(anyString());
  }
  @Test
  public void testWorldImport() {
    // Pull a core instance from the server.
    Plugin plugin = mockServer.getPluginManager().getPlugin("Multiverse-Core");

    // Make sure Core is not null
    assertNotNull(plugin);

    // Make sure Core is enabled
    assertTrue(plugin.isEnabled());

    // Initialize a fake command
    Command mockCommand = mock(Command.class);
    when(mockCommand.getName()).thenReturn("mv");

    // Ensure that there are no worlds imported. This is a fresh setup.
    assertEquals(0, creator.getCore().getMVWorldManager().getMVWorlds().size());

    // Import the first world.
    String[] normalArgs = new String[] {"import", "world", "normal"};
    plugin.onCommand(mockCommandSender, mockCommand, "", normalArgs);

    // We should now have one world imported!
    assertEquals(1, creator.getCore().getMVWorldManager().getMVWorlds().size());

    // Import the second world.
    String[] netherArgs = new String[] {"import", "world_nether", "nether"};
    plugin.onCommand(mockCommandSender, mockCommand, "", netherArgs);

    // We should now have 2 worlds imported!
    assertEquals(2, creator.getCore().getMVWorldManager().getMVWorlds().size());

    // Import the third world.
    String[] skyArgs = new String[] {"import", "world_the_end", "end"};
    plugin.onCommand(mockCommandSender, mockCommand, "", skyArgs);

    // We should now have 2 worlds imported!
    assertEquals(3, creator.getCore().getMVWorldManager().getMVWorlds().size());

    // Verify that the commandSender has been called 3 times.
    verify(mockCommandSender).sendMessage("Starting import of world 'world'...");
    verify(mockCommandSender).sendMessage("Starting import of world 'world_nether'...");
    verify(mockCommandSender).sendMessage("Starting import of world 'world_the_end'...");
    verify(mockCommandSender, VerificationModeFactory.times(3))
        .sendMessage(ChatColor.GREEN + "Complete!");
  }