package de.renew.navigator.gui.actions;

import java.awt.event.ActionEvent;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import de.renew.navigator.models.NavigatorFileTree;
import de.renew.plugin.PluginProperties;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class RemoveAllActionTest {
    private RemoveAllAction _removeAllAction;
    private NavigatorFileTree _navigator;
    private PluginProperties _pluginProperties;

    @BeforeEach
    void setUp() {
        //given
        _navigator = mock(NavigatorFileTree.class);
        _pluginProperties = mock(PluginProperties.class);
        _removeAllAction = new RemoveAllAction(_navigator, _pluginProperties);
    }

    @Test
    public void testRemoveAllAction() {
        //when
        _removeAllAction.actionPerformed(mock(ActionEvent.class));

        //then
        verify(_navigator).clearTreeRoots();
        verify(_navigator).notifyObservers();
    }
}