我可以嘲笑其字段没有getter属性的类吗

时间:2018-08-27 13:02:15

标签: android junit mockito powermockito

如何模拟不具有getter属性的类?我是JUnit的新手,mockito可以帮助我吗?

public class RegisterDeviceApiBody 
{
    @SerializedName("Login")
    private String mLogin;
    @SerializedName("Password")
    private String mPassword;
    @SerializedName("Nickname")
    private String mNickName;

    //setter login
    public void setLogin(final String login) {
        mLogin = login;
    }

    //setter password
    public void setPassword(final String password) {
        mPassword = password;
    }

    //setter nickname
    public void setNickName(final String nickName) {
        mNickName = nickName;
    }
}

0 个答案:

没有答案