Example usage for java.io PipedWriter append

List of usage examples for java.io PipedWriter append

Introduction

In this page you can find the example usage for java.io PipedWriter append.

Prototype

public Writer append(CharSequence csq) throws IOException 

Source Link

Document

Appends the specified character sequence to this writer.

Usage

From source file:com.willwinder.universalgcodesender.AbstractControllerTest.java

/**
 * Test of queueRawStream method, of class AbstractController.
 *///from w w  w .  j  a  v a  2  s . c  om
@Test
public void testQueueRawStreamForComm() throws Exception {
    System.out.println("queueStream");

    String command = "command";
    Collection<String> commands = Arrays.asList(command, command);
    String port = "/some/port";
    int rate = 1234;

    PipedReader in = new PipedReader();
    PipedWriter out = new PipedWriter(in);

    for (String i : commands) {
        out.append(i);
    }

    openInstanceExpectUtility(port, rate);
    streamInstanceExpectUtility();

    // TODO Fix this
    // Making sure the commands get queued.
    mockCommunicator.queueRawStreamForComm(in);
    EasyMock.expect(EasyMock.expectLastCall()).times(1);

    EasyMock.replay(instance, mockCommunicator);

    // Open port, send some commands, make sure they are streamed.
    instance.openCommPort(port, rate);
    instance.queueRawStream(in);
    instance.beginStreaming();

    EasyMock.verify(mockCommunicator, instance);
}