title: annotation @Mock is disallowed for this location in spring junit testcase
body: <p>I am writing unit test for spring controller. My controller is based on Rest API and I am using @RequestBody and @ResponseBody annotation to support that.
  I am getting the “The annotation @Mock is disallowed for this location” error when using @Mock annotation.please suggest.</p>
  
  <p>My Test class is like Below:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>@RunWith(SpringJunit4ClassRunner.class)
  @WebAppConfiguration
  Public class ControllerTest{
  
  Controller1 controller1;
  
  Public void init(){
      controller1= new Controller1 ();
  }
  
  
  @Test
  Public voidd test(){
      ServiceAdaptorClass ServiceAdap= new MockUp&lt;ServiceAdaptorClass&gt;{
              @Mock  // getting error here that “The annotation @Mock is disallowed for this location”
              ReturnType methodname( arg1,arg2) throws Exception{
                   ReturnType returntype;
                   returntype.setProperty(…..);
                   return returntype;
                  }
          }.getMockInstance(); 
  
      mockmvc.perform("url");
      } 
  }
  </code></pre>