use of org.jmock.Expectations in project gradle by gradle.
the class MultilineStringsJavadocOptionFileOptionTest method writeMultipleValues.
@Test
public void writeMultipleValues() throws IOException {
final List<String> tempList = new ArrayList<String>();
final String docUrl1 = "docUrl1";
final String docUrl2 = "docUrl2";
linksOption.getValue().add(docUrl1);
linksOption.getValue().add(docUrl2);
context.checking(new Expectations() {
{
tempList.add(docUrl1);
tempList.add(docUrl2);
oneOf(writerContextMock).writeMultilineValuesOption(optionName, tempList);
}
});
linksOption.writeCollectionValue(writerContextMock);
}
use of org.jmock.Expectations in project gradle by gradle.
the class OptionLessStringsJavadocOptionFileOptionTest method writeNullValue.
@Test
public void writeNullValue() throws IOException {
final String firstValue = "firstValue";
final String secondValue = "secondValue";
context.checking(new Expectations() {
{
oneOf(writerContextMock).write(firstValue);
oneOf(writerContextMock).newLine();
oneOf(writerContextMock).write(secondValue);
oneOf(writerContextMock).newLine();
}
});
optionLessStringsOption.write(writerContextMock);
}
use of org.jmock.Expectations 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.jmock.Expectations 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.jmock.Expectations 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();
}
Aggregations