use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testWriteBytes.
@Test
public void testWriteBytes() throws IOException {
PrintStream delegate = createMock(PrintStream.class);
byte[] bytes = new byte[] { 65, 66, 67 };
delegate.write(bytes);
delegate.close();
EasyMock.expectLastCall().anyTimes();
replay(delegate);
try (DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate)) {
dirtyPrintStream.write(bytes);
verify(delegate);
assertTrue(dirtyPrintStream.isDirty());
}
}
use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintlnInt.
@Test
public void testPrintlnInt() {
PrintStream delegate = createMock(PrintStream.class);
int value = 144;
delegate.println(value);
delegate.close();
EasyMock.expectLastCall().anyTimes();
replay(delegate);
try (DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate)) {
dirtyPrintStream.println(value);
verify(delegate);
assertTrue(dirtyPrintStream.isDirty());
}
}
use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintLong.
@Test
public void testPrintLong() {
PrintStream delegate = createMock(PrintStream.class);
long value = Long.MAX_VALUE;
delegate.print(value);
delegate.close();
EasyMock.expectLastCall().anyTimes();
replay(delegate);
try (DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate)) {
dirtyPrintStream.print(value);
verify(delegate);
assertTrue(dirtyPrintStream.isDirty());
}
}
use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintlnChar.
@Test
public void testPrintlnChar() {
PrintStream delegate = createMock(PrintStream.class);
char value = 'z';
delegate.println(value);
delegate.close();
EasyMock.expectLastCall().anyTimes();
replay(delegate);
try (DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate)) {
dirtyPrintStream.println(value);
verify(delegate);
assertTrue(dirtyPrintStream.isDirty());
}
}
use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintDouble.
@Test
public void testPrintDouble() {
PrintStream delegate = createMock(PrintStream.class);
double value = Math.PI;
delegate.print(value);
delegate.close();
EasyMock.expectLastCall().anyTimes();
replay(delegate);
try (DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate)) {
dirtyPrintStream.print(value);
verify(delegate);
assertTrue(dirtyPrintStream.isDirty());
}
}
Aggregations