use of org.jmock.Expectations in project gocd by gocd.
the class SvnMaterialTest method shouldCheckoutForInvalidSvnWorkingCopy.
@Test
public void shouldCheckoutForInvalidSvnWorkingCopy() {
final File workingCopy = createSvnWorkingCopy(false);
context.checking(new Expectations() {
{
one(subversion).checkoutTo(outputStreamConsumer, workingCopy, revision);
}
});
updateMaterial(svnMaterial, revision, workingCopy);
assertThat(workingCopy.exists(), is(false));
}
use of org.jmock.Expectations in project gocd by gocd.
the class SvnMaterialTest method shouldCheckoutWhenFolderDoesNotExist.
@Test
public void shouldCheckoutWhenFolderDoesNotExist() {
final File workingCopy = new File("xyz");
context.checking(new Expectations() {
{
one(subversion).checkoutTo(outputStreamConsumer, workingCopy, revision);
}
});
updateMaterial(svnMaterial, revision, workingCopy);
}
use of org.jmock.Expectations in project gocd by gocd.
the class SvnMaterialTest method shouldLogRepoInfoToConsoleOutWithOutFolder.
@Test
public void shouldLogRepoInfoToConsoleOutWithOutFolder() throws Exception {
final File workingCopy = new File("xyz");
context.checking(new Expectations() {
{
one(subversion).checkoutTo(outputStreamConsumer, workingCopy, revision);
}
});
updateMaterial(svnMaterial, revision, workingCopy);
String stdout = outputStreamConsumer.getStdOut();
assertThat(stdout, containsString(String.format("Start updating %s at revision %s from %s", "files", revision.getRevision(), svnMaterial.getUrl())));
}
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());
}
Aggregations