Why does the Spring Autowire stops working when I add the "RunWith" annotation?

Viewed 3555

Once I add the RunWith annotation, that is @RunWith(PowerMockRunner.class) the Spring Autowire does not work anymore!

class B {  
  @Autowire  
  SessionFactory session;
}

@RunWith(PowerMockRunner.class)  
@PrepareForTest{SomeClass.class}

class Testing {  

  @Test
  methodA(){  
    //mehod 
  }

  @Test
  methodD(){  
  }    
}  

Now, method A makes a call to class B, but due to RunWith(PowerMockRunner) annotation, the Autowiring is not working. Any help would be greatly appreciated!

2 Answers
Related