Search in sources :

Example 1 with AuditEventLogger

use of org.odk.collect.android.formentry.audit.AuditEventLogger in project collect by opendatakit.

the class BackgroundAudioViewModelTest method setBackgroundRecordingEnabled_whenFalse_logsEventToAuditLog.

@Test
public void setBackgroundRecordingEnabled_whenFalse_logsEventToAuditLog() {
    FormController formController = mock(FormController.class);
    AuditEventLogger auditEventLogger = mock(AuditEventLogger.class);
    when(formController.getAuditEventLogger()).thenReturn(auditEventLogger);
    viewModel.formLoaded(formController);
    when(clock.get()).thenReturn(1234L);
    viewModel.setBackgroundRecordingEnabled(false);
    verify(auditEventLogger).logEvent(AuditEvent.AuditEventType.BACKGROUND_AUDIO_DISABLED, true, 1234L);
}
Also used : FormController(org.odk.collect.android.javarosawrapper.FormController) AuditEventLogger(org.odk.collect.android.formentry.audit.AuditEventLogger) Test(org.junit.Test)

Example 2 with AuditEventLogger

use of org.odk.collect.android.formentry.audit.AuditEventLogger in project collect by opendatakit.

the class BackgroundAudioViewModelTest method setBackgroundRecordingEnabled_whenTrue_logsEventToAuditLog.

@Test
public void setBackgroundRecordingEnabled_whenTrue_logsEventToAuditLog() {
    FormController formController = mock(FormController.class);
    AuditEventLogger auditEventLogger = mock(AuditEventLogger.class);
    when(formController.getAuditEventLogger()).thenReturn(auditEventLogger);
    viewModel.formLoaded(formController);
    when(clock.get()).thenReturn(1234L);
    viewModel.setBackgroundRecordingEnabled(true);
    verify(auditEventLogger).logEvent(AuditEvent.AuditEventType.BACKGROUND_AUDIO_ENABLED, true, 1234L);
}
Also used : FormController(org.odk.collect.android.javarosawrapper.FormController) AuditEventLogger(org.odk.collect.android.formentry.audit.AuditEventLogger) Test(org.junit.Test)

Example 3 with AuditEventLogger

use of org.odk.collect.android.formentry.audit.AuditEventLogger in project collect by opendatakit.

the class FormEntryViewModelTest method setup.

@Before
public void setup() {
    formController = mock(FormController.class);
    startingIndex = new FormIndex(null, 0, 0, new TreeReference());
    when(formController.getFormIndex()).thenReturn(startingIndex);
    when(formController.getFormDef()).thenReturn(new FormDef());
    AuditEventLogger auditEventLogger = mock(AuditEventLogger.class);
    when(formController.getAuditEventLogger()).thenReturn(auditEventLogger);
    viewModel = new FormEntryViewModel(mock(Supplier.class));
    viewModel.formLoaded(formController);
}
Also used : FormController(org.odk.collect.android.javarosawrapper.FormController) AuditEventLogger(org.odk.collect.android.formentry.audit.AuditEventLogger) TreeReference(org.javarosa.core.model.instance.TreeReference) FormDef(org.javarosa.core.model.FormDef) FormIndex(org.javarosa.core.model.FormIndex) Before(org.junit.Before)

Aggregations

AuditEventLogger (org.odk.collect.android.formentry.audit.AuditEventLogger)3 FormController (org.odk.collect.android.javarosawrapper.FormController)3 Test (org.junit.Test)2 FormDef (org.javarosa.core.model.FormDef)1 FormIndex (org.javarosa.core.model.FormIndex)1 TreeReference (org.javarosa.core.model.instance.TreeReference)1 Before (org.junit.Before)1