Search in sources :

Example 1 with SerialCommunicatorListener

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

the class BufferedCommunicatorTest method responseMessageOnErrorShouldDispatchPauseEvent.

@Test
public void responseMessageOnErrorShouldDispatchPauseEvent() {
    // Given
    Connection connection = mock(Connection.class);
    instance.setConnection(connection);
    SerialCommunicatorListener serialCommunicatorListener = mock(SerialCommunicatorListener.class);
    instance.addCommandEventListener(serialCommunicatorListener);
    asl.add(new GcodeCommand("G0"));
    asl.add(new GcodeCommand("G0"));
    instance.streamCommands();
    // When
    instance.responseMessage("error");
    // Then
    assertTrue(instance.isPaused());
    verify(serialCommunicatorListener, times(1)).communicatorPausedOnError();
}
Also used : SerialCommunicatorListener(com.willwinder.universalgcodesender.listeners.SerialCommunicatorListener) Connection(com.willwinder.universalgcodesender.connection.Connection) GcodeCommand(com.willwinder.universalgcodesender.types.GcodeCommand) Test(org.junit.Test) GcodeStreamTest(com.willwinder.universalgcodesender.utils.GcodeStreamTest)

Aggregations

Connection (com.willwinder.universalgcodesender.connection.Connection)1 SerialCommunicatorListener (com.willwinder.universalgcodesender.listeners.SerialCommunicatorListener)1 GcodeCommand (com.willwinder.universalgcodesender.types.GcodeCommand)1 GcodeStreamTest (com.willwinder.universalgcodesender.utils.GcodeStreamTest)1 Test (org.junit.Test)1