Search in sources :

Example 96 with Expectations

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));
}
Also used : Expectations(org.jmock.Expectations) File(java.io.File) Test(org.junit.Test)

Example 97 with Expectations

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);
}
Also used : Expectations(org.jmock.Expectations) File(java.io.File) Test(org.junit.Test)

Example 98 with Expectations

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())));
}
Also used : Expectations(org.jmock.Expectations) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) Test(org.junit.Test)

Example 99 with Expectations

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();
}
Also used : Expectations(org.jmock.Expectations) LineBufferingOutputStream(org.gradle.internal.io.LineBufferingOutputStream) Test(org.junit.Test)

Example 100 with Expectations

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());
}
Also used : Expectations(org.jmock.Expectations) LineBufferingOutputStream(org.gradle.internal.io.LineBufferingOutputStream) Test(org.junit.Test)

Aggregations

Expectations (org.jmock.Expectations)651 Test (org.junit.Test)443 UnitTest (org.apache.geode.test.junit.categories.UnitTest)109 File (java.io.File)46 ConfigurationServiceImpl (org.nhindirect.config.service.impl.ConfigurationServiceImpl)41 InternalCache (org.apache.geode.internal.cache.InternalCache)35 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)33 SlingHttpServletResponse (org.apache.sling.api.SlingHttpServletResponse)32 Resource (org.apache.sling.api.resource.Resource)31 RewriterResponse (org.apache.sling.security.impl.ContentDispositionFilter.RewriterResponse)31 ArrayList (java.util.ArrayList)27 DiskStore (org.apache.geode.cache.DiskStore)23 ValueMap (org.apache.sling.api.resource.ValueMap)21 Before (org.junit.Before)20 CertificateGetOptions (org.nhindirect.config.service.impl.CertificateGetOptions)20 Sequence (org.jmock.Sequence)19 Cache (org.apache.geode.cache.Cache)18 Region (org.apache.geode.cache.Region)18 DistributedMember (org.apache.geode.distributed.DistributedMember)18 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)17