Exemplo n.º 1
0
 @Test
 public void save_shouldNotFinishTheActivityIfThereIsAnExceptionWhileSaving()
     throws Exception, FormController.FormDataSaveException {
   doThrow(new FormController.FormDataSaveException(null)).when(controller).saveFormData(formData);
   when(activity.getString(anyInt())).thenReturn("success");
   store.save("data", "xmldata", "status");
   verify(activity, times(0)).finish();
 }
Exemplo n.º 2
0
 @Before
 public void setUp() throws Exception {
   initMocks(this);
   controller = mock(FormController.class);
   activity = mock(FormWebViewActivity.class);
   formData = new FormData();
   formData.setPatientUuid("adasdssd");
   muzimaApplication = mock(MuzimaApplication.class);
   obsController = mock(ObservationController.class);
   when(muzimaApplication.getObservationController()).thenReturn(obsController);
   when(activity.getApplicationContext()).thenReturn(muzimaApplication);
   store =
       new FormDataStore(activity, controller, formData) {
         @Override
         public FormParser getFormParser() {
           return formParser;
         }
       };
 }