5

I have folowing code:

        @RunWith(PowerMockRunner.class)
        @PrepareForTest({RequestUtils.class, OsgiUtil.class})
        @PowerMockIgnore({"*"})
        public class MyTest
            ...
             @Test
             public somMethod(){    
                ....  
                mockStatic(RequestUtils.class);
                when(RequestUtils.getLocale(request)).thenReturn(locale);
            }
        }  

How to replace this code so that it work without @RunWith(PowerMockRunner.class)?

According the cause described in following link I cannot use @RunWith(PowerMockRunner.class)

Community
  • 1
  • 1
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710

1 Answers1

2

Take a look on this discussion: issues while using @RunWith Annotation and powerMock

One of the answers recommends to use PowerMockRule instead of runner. This solution should be good for you.

Community
  • 1
  • 1
AlexR
  • 114,158
  • 16
  • 130
  • 208