maven
注意powermock-api-mockito 2.0以上给项目重新起了个名字。
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.9</version>
</dependency>
@RunWith(PowerMockRunner.class)
@PrepareForTest({RedisKeyUtil.class})
PowerMockito.mockStatic(System.class);
PowerMockito.when(System.getenv("123")).thenReturn("123");