Mock以外

System.getEnv

testCompile 'com.github.stefanbirkner:system-rules:1.19.0’
 @Rule
public final EnvironmentVariables environmentVariables = new EnvironmentVariables();
 @Before
public void prepareArgs() throws Exception {
    environmentVariables.set("DPCS_REQUEST_TYPE", "Delete”);
}

私有变量

TransformResult transformResult = new TransformResult();
MemberModifier.field(TransformResult.class, "totalLines").set(transformResult, 1514); 
posted @ 2020-04-02 17:19  Anna_blog  阅读(94)  评论(0)    收藏  举报