Search in sources :

Example 1 with UGSEventListener

use of com.willwinder.universalgcodesender.listeners.UGSEventListener in project Universal-G-Code-Sender by winder.

the class GUIBackendTest method setUp.

@Before
public void setUp() throws Exception {
    // We need to mock the method that loads the controller
    instance = spy(new GUIBackend());
    IFirmwareSettings firmwareSettings = mock(IFirmwareSettings.class);
    controller = mock(AbstractController.class);
    doReturn(controller).when(instance).fetchControllerFromFirmware(any());
    doReturn(firmwareSettings).when(controller).getFirmwareSettings();
    // Add a event listener that stores events in the argument captor
    UGSEventListener ugsEventListener = mock(UGSEventListener.class);
    eventArgumentCaptor = ArgumentCaptor.forClass(UGSEvent.class);
    doNothing().when(ugsEventListener).UGSEvent(eventArgumentCaptor.capture());
    instance.addUGSEventListener(ugsEventListener);
    // Add settings
    settings = new Settings();
    instance.applySettings(settings);
}
Also used : UGSEventListener(com.willwinder.universalgcodesender.listeners.UGSEventListener) IFirmwareSettings(com.willwinder.universalgcodesender.firmware.IFirmwareSettings) IFirmwareSettings(com.willwinder.universalgcodesender.firmware.IFirmwareSettings) Settings(com.willwinder.universalgcodesender.utils.Settings) AbstractController(com.willwinder.universalgcodesender.AbstractController) Before(org.junit.Before)

Aggregations

AbstractController (com.willwinder.universalgcodesender.AbstractController)1 IFirmwareSettings (com.willwinder.universalgcodesender.firmware.IFirmwareSettings)1 UGSEventListener (com.willwinder.universalgcodesender.listeners.UGSEventListener)1 Settings (com.willwinder.universalgcodesender.utils.Settings)1 Before (org.junit.Before)1