test_class.file: collect_app/src/test/java/org/odk/collect/android/preferences/AggregatePreferencesAdderTest.java
test_class.identifier: AggregatePreferencesAdderTest
test_case.body: @Test
      public void whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError() {
          putBooleanToSharedPrefs("password", false);
  
          PreferenceFragment fragment = Robolectric.buildFragment(TestPreferenceFragment.class).create().resume().visible().get();
          AggregatePreferencesAdder loader = new AggregatePreferencesAdder(fragment);
  
          boolean result = loader.add();
          assertFalse(result);
  
          String toastText = ShadowToast.getTextOfLatestToast();
          assertEquals(toastText, getString(R.string.corrupt_imported_preferences_error));
      }
test_case.class_method_signature: AggregatePreferencesAdderTest.whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError()
test_case.full_signature: @Test public void whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError()
test_case.identifier: whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError
test_case.invocations: putBooleanToSharedPrefs get visible resume create buildFragment add assertFalse getTextOfLatestToast assertEquals getString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError()
focal_class.declarator: fragment
focal_class.modifier: private final
focal_class.original_string: private final PreferenceFragment fragment;
focal_class.type: PreferenceFragment
focal_class.var_name: fragment
focal_class.file: collect_app/src/main/java/org/odk/collect/android/preferences/AggregatePreferencesAdder.java
focal_class.identifier: AggregatePreferencesAdder
focal_class.class_method_signature: AggregatePreferencesAdder.AggregatePreferencesAdder(PreferenceFragment fragment)
focal_class.full_signature:   AggregatePreferencesAdder(PreferenceFragment fragment)
focal_class.identifier: AggregatePreferencesAdder
focal_class.parameters: (PreferenceFragment fragment)
focal_class.signature:  AggregatePreferencesAdder(PreferenceFragment fragment)
focal_class.class_method_signature: AggregatePreferencesAdder.add()
focal_class.full_signature: public boolean add()
focal_class.identifier: add
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean add()
focal_method.body: public boolean add() {
          try {
              fragment.addPreferencesFromResource(R.xml.aggregate_preferences);
              return true;
          } catch (ClassCastException e) {
              Toast.makeText(fragment.getActivity(), R.string.corrupt_imported_preferences_error, Toast.LENGTH_LONG).show();
              return false;
          }
      }
focal_method.class_method_signature: AggregatePreferencesAdder.add()
focal_method.full_signature: public boolean add()
focal_method.identifier: add
focal_method.invocations: addPreferencesFromResource show makeText getActivity
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean add()