Can PowerMock be used with ElasticsearchIntegrationTest?
<p>I have been using <strong>ElasticsearchIntegrationTest</strong> for testing my code without elasticsearch server. There are few private members in my class so thought of using <strong>Powermock</strong> for accessing private members. While running test i get exception.</p>

<p><strong>Can Powermock be used with ElasticsearchIntegrationTest??</strong></p>

<p><strong>Code :</strong></p>

<pre><code>import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;


@RunWith(PowerMockRunner.class)
@PrepareForTest(AbstractTest.class)
public class PowerMockitTest extends ElasticsearchIntegrationTest{

    AbstractTest abstractTest =  mock(AbstractTest.class);

    @Test
    public void testPowerMokito() throws Exception{
      doReturn(internalCluster().transportClient()).when(abstractImporter, "initClient");
    }

}
</code></pre>

<p><strong>Exception :</strong></p>

<p>java.lang.IllegalStateException: Failed to transform class with name org.elasticsearch.test.ElasticsearchIntegrationTest. Reason: cannot find org.apache.http.impl.client.CloseableHttpClient   at 
    org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:267)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:180)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:70)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:270)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:180)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:70)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:145)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:40)
    at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:244)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.(JUnit4TestSuiteChunkerImpl.java:61)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.(AbstractCommonPowerMockRunner.java:32)
    at org.powermock.modules.junit4.PowerMockRunner.(PowerMockRunner.java:34)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)</p>

<p>Caused by: javassist.CannotCompileException: cannot find     org.apache.http.impl.client.CloseableHttpClient
    at javassist.expr.NewExpr.replace(NewExpr.java:215)
    at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:418)
    at javassist.expr.ExprEditor.loopBody(ExprEditor.java:212)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:91)
    at javassist.CtClassType.instrument(CtClassType.java:1437)
    at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:74)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:252)
    ... 36 more</p>

<p>Caused by: javassist.NotFoundException: org.apache.http.impl.client.CloseableHttpClient
    at javassist.ClassPool.get(ClassPool.java:452)
    at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:592)
    at javassist.bytecode.Descriptor.getParameterTypes(Descriptor.java:439)
    at javassist.expr.NewExpr.replace(NewExpr.java:188)
    ... 42 more</p>