<commit_before>package cc.softwarefactory.lokki.android.espresso.utilities;


import com.android.support.test.deps.guava.hash.Hashing;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MockJsonUtils {


    public static String getContactsJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("<EMAIL>", new JSONObject().put("id", 1).put("name", "<NAME>"))
                .put("<EMAIL>", new JSONObject().put("id", 2).put("name", "Family Member"))
                .put("<EMAIL>", new JSONObject().put("id", 3).put("name", "<NAME>"))
                .put("mapping", new JSONObject().put("Test Friend", "<EMAIL>")
                                                .put("Family Member", "<EMAIL>")
                                                .put("Work Buddy", "<EMAIL>"));


        return jsonObject.toString();
    }



    public static String getPlacesJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("cb693820-3ce7-4c95-af2f-1f079d2841b1", new JSONObject()
                        .put("lat", "37.483477313364574")
                        .put("lon", "-122.14838393032551")
                        .put("rad", "100")
                        .put("name", "Testplace1")
                        .put("img", ""));

        jsonObject.put("105df9a7-33cc-4880-9001-66aab110c3dd", new JSONObject()
                        .put("lat", "40.2290817553899")
                        .put("lon", "-116.64331555366516")
                        .put("rad", "100")
                        .put("name", "Testplace2")
                        .put("img", ""));

        return jsonObject.toString();
    }




    public static String getOneContact() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("<EMAIL>", new JSONObject().put("id", 1).put("name", "<NAME>"))
                .put("<EMAIL>", new JSONObject().put("id", 2).put("name", "Family Member"))
                .put("<EMAIL>", new JSONObject().put("id", 3).put("name", "<NAME>"))
                .put("mapping", new JSONObject().put("Test Friend", "<EMAIL>")
                                                .put("Family Member", "<EMAIL>")
                                                .put("<NAME>", "<EMAIL>"));


        return jsonObject.toString();
    }

    public static String getEmptyDashboardJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("battery", "")
                .put("canseeme", new JSONArray())
                .put("icansee", new JSONObject())
                .put("idmapping", new JSONObject().put(TestUtils.VALUE_TEST_USER_ID, TestUtils.VALUE_TEST_USER_ACCOUNT))
                .put("location", new JSONObject())
                .put("visibility", true);

        return jsonObject.toString();
    }


    public static String getDashboardJsonWithContacts(String... contactEmails) throws JSONException {
        JSONArray canseemeJsonArray = new JSONArray();
        JSONObject icanseeJsonObject = new JSONObject();
        JSONObject idmappingJsonObject = new JSONObject().put(TestUtils.VALUE_TEST_USER_ID, TestUtils.VALUE_TEST_USER_ACCOUNT);

        for (String contactEmail : contactEmails) {
            String contactId = Hashing.sha1().hashString(contactEmail).toString();

            canseemeJsonArray.put(contactId);

            icanseeJsonObject.put(contactId, new JSONObject()
                    .put("battery", "")
                    .put("location", new JSONObject())
                    .put("visibility", true));

            idmappingJsonObject.put(contactId, contactEmail);
        }


        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("battery", "")
                .put("canseeme", canseemeJsonArray)
                .put("icansee", icanseeJsonObject)
                .put("idmapping", idmappingJsonObject)
                .put("location", new JSONObject())
                .put("visibility", true);

        return jsonObject.toString();
    }

    public static String getEmptyPlacesJson() throws JSONException {
        return "{}";
    }

    public static String getSignupResponse(String id, String[] canSeeMe, String[] iCanSee, String authorizationToken) throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("id", id);
        jsonObject.put("canseeme", canSeeMe);
        jsonObject.put("icansee", iCanSee);
        jsonObject.put("authorizationtoken", authorizationToken);
        return jsonObject.toString();
    }

}<commit_msg>Chain .put() calls<commit_after>package cc.softwarefactory.lokki.android.espresso.utilities;


import com.android.support.test.deps.guava.hash.Hashing;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MockJsonUtils {


    public static String getContactsJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("<EMAIL>", new JSONObject().put("id", 1).put("name", "<NAME>"))
                .put("<EMAIL>", new JSONObject().put("id", 2).put("name", "Family Member"))
                .put("<EMAIL>", new JSONObject().put("id", 3).put("name", "<NAME>"))
                .put("mapping", new JSONObject().put("Test Friend", "<EMAIL>")
                                                .put("Family Member", "<EMAIL>")
                                                .put("Work Buddy", "<EMAIL>"));


        return jsonObject.toString();
    }



    public static String getPlacesJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("cb693820-3ce7-4c95-af2f-1f079d2841b1", new JSONObject()
                        .put("lat", "37.483477313364574")
                        .put("lon", "-122.14838393032551")
                        .put("rad", "100")
                        .put("name", "Testplace1")
                        .put("img", ""));

        jsonObject.put("105df9a7-33cc-4880-9001-66aab110c3dd", new JSONObject()
                        .put("lat", "40.2290817553899")
                        .put("lon", "-116.64331555366516")
                        .put("rad", "100")
                        .put("name", "Testplace2")
                        .put("img", ""));

        return jsonObject.toString();
    }




    public static String getOneContact() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("<EMAIL>", new JSONObject().put("id", 1).put("name", "<NAME>"))
                .put("<EMAIL>", new JSONObject().put("id", 2).put("name", "Family Member"))
                .put("<EMAIL>", new JSONObject().put("id", 3).put("name", "<NAME>"))
                .put("mapping", new JSONObject().put("Test Friend", "<EMAIL>")
                                                .put("Family Member", "<EMAIL>")
                                                .put("Work Buddy", "<EMAIL>"));


        return jsonObject.toString();
    }

    public static String getEmptyDashboardJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("battery", "")
                .put("canseeme", new JSONArray())
                .put("icansee", new JSONObject())
                .put("idmapping", new JSONObject().put(TestUtils.VALUE_TEST_USER_ID, TestUtils.VALUE_TEST_USER_ACCOUNT))
                .put("location", new JSONObject())
                .put("visibility", true);

        return jsonObject.toString();
    }


    public static String getDashboardJsonWithContacts(String... contactEmails) throws JSONException {
        JSONArray canseemeJsonArray = new JSONArray();
        JSONObject icanseeJsonObject = new JSONObject();
        JSONObject idmappingJsonObject = new JSONObject().put(TestUtils.VALUE_TEST_USER_ID, TestUtils.VALUE_TEST_USER_ACCOUNT);

        for (String contactEmail : contactEmails) {
            String contactId = Hashing.sha1().hashString(contactEmail).toString();

            canseemeJsonArray.put(contactId);

            icanseeJsonObject.put(contactId, new JSONObject()
                    .put("battery", "")
                    .put("location", new JSONObject())
                    .put("visibility", true));

            idmappingJsonObject.put(contactId, contactEmail);
        }


        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("battery", "")
                .put("canseeme", canseemeJsonArray)
                .put("icansee", icanseeJsonObject)
                .put("idmapping", idmappingJsonObject)
                .put("location", new JSONObject())
                .put("visibility", true);

        return jsonObject.toString();
    }

    public static String getEmptyPlacesJson() throws JSONException {
        return "{}";
    }

    public static String getSignupResponse(String id, String[] canSeeMe, String[] iCanSee, String authorizationToken) throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject
                .put("id", id)
                .put("canseeme", canSeeMe)
                .put("icansee", iCanSee)
                .put("authorizationtoken", authorizationToken);

        return jsonObject.toString();
    }

}
{'fraction_non_alphanumeric': 0.1385427666314678, 'fraction_numerical': 0.02597676874340021, 'mean_word_length': 1.9811142587346553, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3961068', 'n_tokens_mistral': 2686, 'n_tokens_neox': 2425, 'n_words': 502}