use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsLineWhichIsLongerThanInitialBufferLength.
@Test
public void logsLineWhichIsLongerThanInitialBufferLength() throws IOException {
System.setProperty("line.separator", "-");
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("a line longer than 8 bytes long-");
one(action).text("line 2");
}
});
outputStream.write("a line longer than 8 bytes long-".getBytes());
outputStream.write("line 2".getBytes());
outputStream.flush();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method handlesMultiCharacterLineSeparator.
@Test
public void handlesMultiCharacterLineSeparator() throws IOException {
final String separator = new String(new byte[] { '\r', '\n' });
System.setProperty("line.separator", separator);
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("line 1" + separator);
one(action).text("line 2" + separator);
}
});
outputStream.write(("line 1" + separator + "line 2" + separator).getBytes());
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsNothingOnCloseWhenCompleteLineHasBeenWrittenToStream.
@Test
public void logsNothingOnCloseWhenCompleteLineHasBeenWrittenToStream() throws IOException {
System.setProperty("line.separator", "-");
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("line 1-");
one(action).endOfStream(null);
}
});
outputStream.write("line 1-".getBytes());
outputStream.close();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsPartialLineOnFlush.
@Test
public void logsPartialLineOnFlush() throws IOException {
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("line 1");
}
});
outputStream.write("line 1".getBytes());
outputStream.flush();
}
use of org.gradle.internal.io.LineBufferingOutputStream in project gradle by gradle.
the class LineBufferingOutputStreamTest method logsEmptyLines.
@Test
public void logsEmptyLines() throws IOException {
System.setProperty("line.separator", "-");
LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
context.checking(new Expectations() {
{
one(action).text("-");
one(action).text("-");
}
});
outputStream.write("--".getBytes());
}
Aggregations