use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintlnBoolean.
@Test
public void testPrintlnBoolean() {
PrintStream delegate = createMock(PrintStream.class);
boolean value = false;
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 testAppendChar.
@Test
public void testAppendChar() {
PrintStream delegate = createMock(PrintStream.class);
char value = 'q';
expect(delegate.append(value)).andReturn(delegate);
replay(delegate);
DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate);
PrintStream valueToChain = dirtyPrintStream.append(value);
verify(delegate);
assertEquals(dirtyPrintStream, valueToChain);
assertTrue(dirtyPrintStream.isDirty());
}
use of java.io.PrintStream in project buck by facebook.
the class DirtyPrintStreamDecoratorTest method testPrintInt.
@Test
public void testPrintInt() {
PrintStream delegate = createMock(PrintStream.class);
int value = 42;
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 testPrintCharArray.
@Test
public void testPrintCharArray() {
PrintStream delegate = createMock(PrintStream.class);
char[] value = new char[] { 'h', 'e', 'l', 'l', 'o' };
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 testFormatWithoutLocale.
@Test
public void testFormatWithoutLocale() {
PrintStream delegate = createMock(PrintStream.class);
String formatString = "Build target [%s] does not exist.";
String greeter = "//foo:bar";
expect(delegate.format(formatString, greeter)).andReturn(delegate);
replay(delegate);
DirtyPrintStreamDecorator dirtyPrintStream = new DirtyPrintStreamDecorator(delegate);
PrintStream valueToChain = dirtyPrintStream.format(formatString, greeter);
verify(delegate);
assertEquals(dirtyPrintStream, valueToChain);
assertTrue(dirtyPrintStream.isDirty());
}
Aggregations