@@ -0,0 +1,2787 @@
+package io.digdag.core.session;%0A%0Aimport com.google.inject.Guice;%0Aimport io.digdag.client.config.ConfigException;%0Aimport io.digdag.client.config.ConfigFactory;%0Aimport io.digdag.core.ErrorReporter;%0Aimport io.digdag.core.Limits;%0Aimport io.digdag.core.database.TransactionManager;%0Aimport io.digdag.core.repository.ModelValidationException;%0Aimport io.digdag.core.workflow.WorkflowExecutor;%0Aimport io.digdag.spi.metrics.DigdagMetrics;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Mockito.doThrow;%0Aimport static org.mockito.Mockito.spy;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class SessionMonitorExecutorTest%0A%7B%0A    @Mock%0A    ConfigFactory configFactory;%0A    @Mock%0A    SessionStoreManager sessionStoreManager;%0A    @Mock%0A    TransactionManager transactionManager;%0A    @Mock%0A    WorkflowExecutor workflowExecutor;%0A    @Mock%0A    Limits limits;%0A    @Mock%0A    ErrorReporter errorReporter;%0A    @Mock%0A    DigdagMetrics digdagMetrics;%0A%0A    private SessionMonitorExecutor sessionMonitorExecutor;%0A%0A    @Before%0A    public void setUp()%0A    %7B%0A        sessionMonitorExecutor = spy(Guice.createInjector(binder -%3E %7B%0A            binder.bind(ConfigFactory.class).toInstance(configFactory);%0A            binder.bind(SessionStoreManager.class).toInstance(sessionStoreManager);%0A            binder.bind(TransactionManager.class).toInstance(transactionManager);%0A            binder.bind(WorkflowExecutor.class).toInstance(workflowExecutor);%0A            binder.bind(Limits.class).toInstance(limits);%0A            binder.bind(ErrorReporter.class).toInstance(errorReporter);%0A            binder.bind(DigdagMetrics.class).toInstance(digdagMetrics);%0A        %7D).getInstance(SessionMonitorExecutor.class));%0A%0A    %7D%0A%0A    @Test%0A    public void handleUnexpectedExceptionInRun()%0A    %7B%0A        doThrow(RuntimeException.class).when(transactionManager).begin(any());%0A%0A        sessionMonitorExecutor.run();%0A%0A        verify(errorReporter, times(1)).reportUncaughtError(any(RuntimeException.class));%0A    %7D%0A%0A    @Test%0A    public void handleConfigExceptionInRun()%0A    %7B%0A        doThrow(ConfigException.class).when(transactionManager).begin(any());%0A%0A        sessionMonitorExecutor.run();%0A%0A        verify(errorReporter, times(0)).reportUncaughtError(any(RuntimeException.class));%0A    %7D%0A%0A    @Test%0A    public void handleModelValidationExceptionInRun()%0A    %7B%0A        doThrow(ModelValidationException.class).when(transactionManager).begin(any());%0A%0A        sessionMonitorExecutor.run();%0A%0A        verify(errorReporter, times(0)).reportUncaughtError(any(RuntimeException.class));%0A    %7D%0A%7D%0A

Add tests