Back to project page PreCTS.
The source code is released under:
Apache License
If you think the Android project PreCTS listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.androidhuman.ctsprepare.automator; /* w w w . jav a 2s . c om*/ import org.json.JSONException; import org.json.JSONObject; public class GoogleAccount { public String email; public String password; public static GoogleAccount fromJson(String json) throws JSONException{ JSONObject obj = new JSONObject(json); GoogleAccount account = new GoogleAccount(); account.email = obj.getString("email"); account.password = obj.getString("password"); if(account.email==null || account.password==null){ throw new IllegalStateException("Could not load the account informaion."); } return account; } public String toJson() throws JSONException{ // Check all instance is not null if(this.email==null || this.password==null){ throw new IllegalStateException("Invalid Account information"); } JSONObject obj = new JSONObject(); obj.put("email", this.email); obj.put("password", this.password); return obj.toString(); } }