use of com.willwinder.universalgcodesender.connection.Connection in project Universal-G-Code-Sender by winder.
the class BufferedCommunicatorTest method responseMessageOnErrorShouldPauseTheCommunicator.
@Test
public void responseMessageOnErrorShouldPauseTheCommunicator() {
// Given
Connection connection = mock(Connection.class);
instance.setConnection(connection);
asl.add(new GcodeCommand("G0"));
asl.add(new GcodeCommand("G0"));
instance.streamCommands();
// When
instance.responseMessage("error");
// Then
assertTrue(instance.isPaused());
}
use of com.willwinder.universalgcodesender.connection.Connection in project Universal-G-Code-Sender by winder.
the class BufferedCommunicatorTest method responseMessageOnErrorOnManualCommandShouldPauseTheCommunicator.
@Test
public void responseMessageOnErrorOnManualCommandShouldPauseTheCommunicator() {
// Given
Connection connection = mock(Connection.class);
instance.setConnection(connection);
cb.add("G0");
cb.add("G0");
instance.streamCommands();
// When
instance.responseMessage("error");
// Then
assertTrue(instance.isPaused());
}
use of com.willwinder.universalgcodesender.connection.Connection in project Universal-G-Code-Sender by winder.
the class BufferedCommunicatorTest method responseMessageOnErrorOnCommandStreamShouldPauseTheCommunicator.
@Test
public void responseMessageOnErrorOnCommandStreamShouldPauseTheCommunicator() throws IOException, GcodeStreamReader.NotGcodeStreamFile {
// Given
Connection connection = mock(Connection.class);
instance.setConnection(connection);
// Create a gcode file stream
File gcodeFile = new File(tempDir, "gcodeFile");
GcodeStreamWriter gcodeStreamWriter = new GcodeStreamWriter(gcodeFile);
gcodeStreamWriter.addLine("G0", "G0", null, 0);
gcodeStreamWriter.addLine("G0", "G0", null, 0);
gcodeStreamWriter.close();
// Stream
instance.queueStreamForComm(new GcodeStreamReader(gcodeFile));
instance.streamCommands();
// When
instance.responseMessage("error");
// Then
assertTrue(instance.isPaused());
}
use of com.willwinder.universalgcodesender.connection.Connection in project Universal-G-Code-Sender by winder.
the class BufferedCommunicatorTest method responseMessageOnErrorOnLastCommandShouldNotPauseTheCommunicator.
@Test
public void responseMessageOnErrorOnLastCommandShouldNotPauseTheCommunicator() {
// Given
Connection connection = mock(Connection.class);
instance.setConnection(connection);
asl.add(new GcodeCommand("G0"));
instance.streamCommands();
// When
instance.responseMessage("error");
// Then
assertFalse(instance.isPaused());
}
Aggregations