
package gov.hhs.fha.nhinc.event;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;

public class EventManagerTest {

    @Before
    public void before() {
        // Other tests add observers, and our tests need a clean slate.
        EventManager.getInstance().deleteObservers();
    }

    @Test
    public void noRegisteredLoggerDisablesRecording() {
        EventRecorder eventRecorder = EventManager.getInstance();
        assertFalse(eventRecorder.isRecordEventEnabled());
    }

    @Test
    public void oneRegisteredLoggerEnabledRecording() {
        EventLogger mockEventLogger = mock(EventLogger.class);
        EventManager eventManager = EventManager.getInstance();
        eventManager.registerLogger(mockEventLogger);

        assertTrue(eventManager.isRecordEventEnabled());
    }
}
