title: How to mock final variable initialized inside constructor ,using EasyMock and PowerMock?
body: <p>Below mentioned code is implementation class, Need to mock the final variables inside junit .And to set the required value.</p>
  <pre><code>public class XyzInterceptor 
      private final int requestLimit;
      private final int responseLimit;
      LimitHealper limitHealper = LimitHealper.getInstance();
      //Constructor
      public XyzInterceptor() {
          requestLimit = limitHealper.getLimits(&quot;fff&quot;);
          responseLimit = limitHealper.getLimits(&quot;fff&quot;);
              }
              
          public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) {
  
          // Check if rate limit is disabled
          if (requestLimit == 0 &amp;&amp; responseLimit == 0) {
              return true;
          }
          
          //logic inside
          
          }
  }
  </code></pre>
  <p>Test Method</p>
  <pre><code>@Test
      public void preHandelWhenLimitIsavailable() {       
          
          MockHttpServletRequest req = get(&quot;/customResource&quot;)
                  .buildRequest(new MockServletContext());        
                
          MockHttpServletResponse resp = new MockHttpServletResponse();           
              
          XyzInterceptor crrli = PowerMock.createPartialMock(XyzInterceptor.class, &quot;XyzInterceptor&quot;);
          EasyMock.expect(limitHealper.getLimits(EasyMock.anyObject(String.class))).andReturn(6000).anyTimes();
          EasyMock.replay(limitHealper);
          crrli.preHandle(req, resp, &quot;doesn't matter&quot;);        
          Assert.assertEquals(200,resp.getStatus());
          
      }
  </code></pre>
  <p>While running the test  getting below error
  org.powermock.reflect.exceptions.MethodNotFoundException: No methods matching the name(s) XyzInterceptor were found in the class hierarchy of class com.xx.xx.xx.xx.XyzInterceptor.</p>
  <p>Note : On top of the class i have these annotation
  @RunWith(PowerMockRunner.class)
  @PrepareForTest(XyzInterceptor .class)</p>