I\'ve got such a code snippet:
@RunWith(PowerMockRunner.class)
@PrepareForTest({Thread.class})
public class AllMeasuresDataTest {
@Before
public void setUp(
In order to mock system classes, prepare the class that is the target of the test, not Thread.class. There's no way PowerMock will be able to instrument Thread.class because it is required during JVM startup - well before PowerMock can instrument.
The way instrumentation works, once a class is loaded, it can no longer be intstrumented.
See the PowerMock wiki.