NCMB { public static void enableResponseValidation(boolean responseValidation) { sResponseValidation = responseValidation; if (getCurrentContext().context != null) { SharedPreferences data = getCurrentContext().context.getApplicationContext().getSharedPreferences(PREFERENCE_FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = data.edit(); editor.putBoolean(RESPONSE_VALIDATION, responseValidation); editor.apply(); } }  static void initialize(Context context,
                                  String applicationKey,
                                  String clientKey); static void initialize(Context context,
                                  String applicationKey,
                                  String clientKey,
                                  Map<String,String> installationCustomFields); static void initialize(Context context,
                                  String applicationKey,
                                  String clientKey,
                                  String domainUrl,
                                  String apiVersion); static void initialize(Context context,
                                  String applicationKey,
                                  String clientKey,
                                  String domainUrl,
                                  String apiVersion,
                                  Map<String,String> installationCustomFields); static NCMBService factory(ServiceType serviceType); static void setTimeout(int timeout); static int getTimeout(); static NCMBContext getCurrentContext(); static void enableResponseValidation(boolean responseValidation); static final String SDK_VERSION; static final String METADATA_PREFIX; static final String DEFAULT_DOMAIN_URL; static final String DEFAULT_API_VERSION; static final String OAUTH_TWITTER; static final String OAUTH_FACEBOOK; static final String OAUTH_GOOGLE; static final String OAUTH_ANONYMOUS; }
@Test public void enableResponseValidation() throws IOException { NCMB.initialize(RuntimeEnvironment.application.getApplicationContext(), "applicationKey", "clientKey"); SharedPreferences preferences = NCMB.getCurrentContext().context.getApplicationContext().getSharedPreferences("NCMB", Context.MODE_PRIVATE); Assert.assertEquals(false, preferences.getBoolean("responseValidation", false)); NCMB.enableResponseValidation(true); Assert.assertEquals(true, preferences.getBoolean("responseValidation", false)); }