test_class.declarator: incidentService
test_class.modifier: @Mock
test_class.original_string: @Mock
      IncidentService incidentService;
test_class.type: IncidentService
test_class.var_name: incidentService
test_class.declarator: incidentFormService
test_class.modifier: @Mock
test_class.original_string: @Mock
      IncidentFormService incidentFormService;
test_class.type: IncidentFormService
test_class.var_name: incidentFormService
test_class.declarator: incidentRegisterPresenter
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private IncidentRegisterPresenter incidentRegisterPresenter;
test_class.type: IncidentRegisterPresenter
test_class.var_name: incidentRegisterPresenter
test_class.file: app/src/test/java/org/unicef/rapidreg/incident/incidentregister/IncidentRegisterPresenterTest.java
test_class.identifier: IncidentRegisterPresenterTest
test_case.body: @Test
      public void required_Field_is_false_when_save_record() {
          ItemValuesMap itemValuesMap = new ItemValuesMap();
          itemValuesMap.addBooleanItem("is_case", true);
          itemValuesMap.addNumberItem("age", 12);
          RecordRegisterView.SaveRecordCallback callback = mock(RecordRegisterView
                  .SaveRecordCallback.class);
  
          IncidentTemplateForm incidentTemplateForm = mock(IncidentTemplateForm.class);
  
          when(incidentFormService.getGBVTemplate()).thenReturn(incidentTemplateForm);
          when(incidentService.validateRequiredFields(incidentTemplateForm, itemValuesMap))
                  .thenReturn(false);
  
          RecordRegisterView view = mock(RecordRegisterView.class);
          when(view.getFieldValueVerifyResult()).thenReturn(new ItemValuesMap());
  
          incidentRegisterPresenter.attachView(view);
  
          incidentRegisterPresenter.saveRecord(itemValuesMap, new ArrayList<String>(), callback);
          verify(callback, times(1)).onRequiredFieldNotFilled();
      }
test_case.class_method_signature: IncidentRegisterPresenterTest.required_Field_is_false_when_save_record()
test_case.full_signature: @Test public void required_Field_is_false_when_save_record()
test_case.identifier: required_Field_is_false_when_save_record
test_case.invocations: addBooleanItem addNumberItem mock mock thenReturn when getGBVTemplate thenReturn when validateRequiredFields mock thenReturn when getFieldValueVerifyResult attachView saveRecord onRequiredFieldNotFilled verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void required_Field_is_false_when_save_record()
focal_class.declarator: TAG = IncidentRegisterPresenter.class.getSimpleName()
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = IncidentRegisterPresenter.class.getSimpleName();
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: incidentService
focal_class.modifier: private
focal_class.original_string: private IncidentService incidentService;
focal_class.type: IncidentService
focal_class.var_name: incidentService
focal_class.declarator: incidentFormService
focal_class.modifier: private
focal_class.original_string: private IncidentFormService incidentFormService;
focal_class.type: IncidentFormService
focal_class.var_name: incidentFormService
focal_class.file: app/src/main/java/org/unicef/rapidreg/incident/incidentregister/IncidentRegisterPresenter.java
focal_class.identifier: IncidentRegisterPresenter
focal_class.class_method_signature: IncidentRegisterPresenter.IncidentRegisterPresenter(IncidentService incidentService, IncidentFormService
              incidentFormService)
focal_class.full_signature: @Inject public  IncidentRegisterPresenter(IncidentService incidentService, IncidentFormService
              incidentFormService)
focal_class.identifier: IncidentRegisterPresenter
focal_class.modifiers: @Inject public
focal_class.parameters: (IncidentService incidentService, IncidentFormService
              incidentFormService)
focal_class.signature:  IncidentRegisterPresenter(IncidentService incidentService, IncidentFormService
              incidentFormService)
focal_class.class_method_signature: IncidentRegisterPresenter.getRecordId(Bundle bundle)
focal_class.full_signature: @Override protected Long getRecordId(Bundle bundle)
focal_class.identifier: getRecordId
focal_class.modifiers: @Override protected
focal_class.parameters: (Bundle bundle)
focal_class.return: Long
focal_class.signature: Long getRecordId(Bundle bundle)
focal_class.class_method_signature: IncidentRegisterPresenter.getUniqueId(Bundle bundle)
focal_class.full_signature: @Override protected String getUniqueId(Bundle bundle)
focal_class.identifier: getUniqueId
focal_class.modifiers: @Override protected
focal_class.parameters: (Bundle bundle)
focal_class.return: String
focal_class.signature: String getUniqueId(Bundle bundle)
focal_class.class_method_signature: IncidentRegisterPresenter.saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_class.full_signature: @Override public void saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_class.identifier: saveRecord
focal_class.modifiers: @Override public
focal_class.parameters: (ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_class.return: void
focal_class.signature: void saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_class.class_method_signature: IncidentRegisterPresenter.getItemValuesByRecordId(Long recordId)
focal_class.full_signature: @Override protected ItemValuesMap getItemValuesByRecordId(Long recordId)
focal_class.identifier: getItemValuesByRecordId
focal_class.modifiers: @Override protected
focal_class.parameters: (Long recordId)
focal_class.return: ItemValuesMap
focal_class.signature: ItemValuesMap getItemValuesByRecordId(Long recordId)
focal_class.class_method_signature: IncidentRegisterPresenter.getItemValuesByUniqueId(String uniqueId)
focal_class.full_signature: @Override protected ItemValuesMap getItemValuesByUniqueId(String uniqueId)
focal_class.identifier: getItemValuesByUniqueId
focal_class.modifiers: @Override protected
focal_class.parameters: (String uniqueId)
focal_class.return: ItemValuesMap
focal_class.signature: ItemValuesMap getItemValuesByUniqueId(String uniqueId)
focal_class.class_method_signature: IncidentRegisterPresenter.getPhotoPathsByRecordId(Long recordId)
focal_class.full_signature: @Override protected List<String> getPhotoPathsByRecordId(Long recordId)
focal_class.identifier: getPhotoPathsByRecordId
focal_class.modifiers: @Override protected
focal_class.parameters: (Long recordId)
focal_class.return: List<String>
focal_class.signature: List<String> getPhotoPathsByRecordId(Long recordId)
focal_class.class_method_signature: IncidentRegisterPresenter.getFields()
focal_class.full_signature: @Override protected List<Field> getFields()
focal_class.identifier: getFields
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: List<Field>
focal_class.signature: List<Field> getFields()
focal_class.class_method_signature: IncidentRegisterPresenter.getFields(int position)
focal_class.full_signature: @Override public List<Field> getFields(int position)
focal_class.identifier: getFields
focal_class.modifiers: @Override public
focal_class.parameters: (int position)
focal_class.return: List<Field>
focal_class.signature: List<Field> getFields(int position)
focal_class.class_method_signature: IncidentRegisterPresenter.getTemplateForm()
focal_class.full_signature: @Override public RecordForm getTemplateForm()
focal_class.identifier: getTemplateForm
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: RecordForm
focal_class.signature: RecordForm getTemplateForm()
focal_class.class_method_signature: IncidentRegisterPresenter.validateRequiredField(ItemValuesMap itemValuesMap)
focal_class.full_signature: private boolean validateRequiredField(ItemValuesMap itemValuesMap)
focal_class.identifier: validateRequiredField
focal_class.modifiers: private
focal_class.parameters: (ItemValuesMap itemValuesMap)
focal_class.return: boolean
focal_class.signature: boolean validateRequiredField(ItemValuesMap itemValuesMap)
focal_class.superclass: extends RecordRegisterPresenter
focal_method.body: @Override
      public void saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback) {
          ItemValuesMap fieldValueVerifyResult = getView().getFieldValueVerifyResult();
          if (fieldValueVerifyResult != null && fieldValueVerifyResult.getValues().size() > 0) {
              callback.onFieldValueInvalid();
              return;
          }
  
          IncidentTemplateForm incidentForm = incidentFormService.getGBVTemplate();
          boolean validateRequiredFields = incidentService.validateRequiredFields(incidentForm,
                  itemValuesMap);
  
          if (!validateRequiredFields) {
              callback.onRequiredFieldNotFilled();
              return;
          }
          clearProfileItems(itemValuesMap);
          try {
              Incident record = incidentService.saveOrUpdate(itemValuesMap);
              addProfileItems(itemValuesMap, record.getRegistrationDate(), record.getUniqueId(), null,
                      record.getId());
              callback.onSaveSuccessful(record.getId());
          } catch (IOException e) {
              callback.onSavedFail();
          }
      }
focal_method.class_method_signature: IncidentRegisterPresenter.saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_method.full_signature: @Override public void saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_method.identifier: saveRecord
focal_method.invocations: getFieldValueVerifyResult getView size getValues onFieldValueInvalid getGBVTemplate validateRequiredFields onRequiredFieldNotFilled clearProfileItems saveOrUpdate addProfileItems getRegistrationDate getUniqueId getId onSaveSuccessful getId onSavedFail
focal_method.modifiers: @Override public
focal_method.parameters: (ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)
focal_method.return: void
focal_method.signature: void saveRecord(ItemValuesMap itemValuesMap, List<String> photoPaths,
                             RecordRegisterView.SaveRecordCallback callback)