简体   繁体   中英

Mock fields of inner static class with easyMock

Is it possible to mock public fields of inner static class

public class SysConfig {

    public static class PackageConfig {
        public boolean checked;
    }

}

I want to mock "checked" field of PackageConfig class.

NOTE: I can't use powermock because i want to find coverage of code and powermock is causing some problems with it.

Since it's a public boolean...you could...set the value :P

Other than that, we'll need some context - how do you intend on using the mock?

PS As far as I know, Powermock should only give you issues with code coverage if you're mocking the class under test.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM