Search in sources :

Example 51 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class LineBufferingOutputStreamTest method logsPartialLineOnFlush.

@Test
public void logsPartialLineOnFlush() throws IOException {
    LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
    context.checking(new Expectations() {

        {
            one(action).text("line 1");
        }
    });
    outputStream.write("line 1".getBytes());
    outputStream.flush();
}
Also used : Expectations(org.jmock.Expectations) LineBufferingOutputStream(org.gradle.internal.io.LineBufferingOutputStream) Test(org.junit.Test)

Example 52 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class DefaultProjectDescriptorTest method setName.

@Test
public void setName() {
    final String newName = "newName";
    final ProjectDescriptorRegistry projectDescriptorRegistryMock = context.mock(ProjectDescriptorRegistry.class);
    projectDescriptor.setProjectDescriptorRegistry(projectDescriptorRegistryMock);
    context.checking(new Expectations() {

        {
            one(projectDescriptorRegistryMock).changeDescriptorPath(Path.path(TEST_NAME), Path.path(Project.PATH_SEPARATOR + newName));
        }
    });
    projectDescriptor.setName(newName);
    assertEquals(newName, projectDescriptor.getName());
}
Also used : Expectations(org.jmock.Expectations) Test(org.junit.Test)

Example 53 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class BuildResultLoggerTest method logsBuildFailedAndTotalTime.

@Test
public void logsBuildFailedAndTotalTime() {
    context.checking(new Expectations() {

        {
            one(buildTimeClock).getElapsed();
            will(returnValue("10s"));
            one(textOutputFactory).create(BuildResultLogger.class, LogLevel.LIFECYCLE);
            will(returnValue(textOutput));
        }
    });
    listener.buildFinished(new BuildResult("Action", null, new RuntimeException()));
    assertEquals("\n{failure}ACTION FAILED{normal}\n\nTotal time: 10s\n", textOutput.getValue());
}
Also used : Expectations(org.jmock.Expectations) BuildResult(org.gradle.BuildResult) Test(org.junit.Test)

Example 54 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class BuildResultLoggerTest method logsBuildSuccessAndTotalTime.

@Test
public void logsBuildSuccessAndTotalTime() {
    context.checking(new Expectations() {

        {
            one(buildTimeClock).getElapsed();
            will(returnValue("10s"));
            one(textOutputFactory).create(BuildResultLogger.class, LogLevel.LIFECYCLE);
            will(returnValue(textOutput));
        }
    });
    listener.buildFinished(new BuildResult("Action", null, null));
    assertEquals("\n{success}ACTION SUCCESSFUL{normal}\n\nTotal time: 10s\n", textOutput.getValue());
}
Also used : Expectations(org.jmock.Expectations) BuildResult(org.gradle.BuildResult) Test(org.junit.Test)

Example 55 with Expectations

use of org.jmock.Expectations in project gradle by gradle.

the class LineBufferingOutputStreamTest method logsEmptyLines.

@Test
public void logsEmptyLines() throws IOException {
    System.setProperty("line.separator", "-");
    LineBufferingOutputStream outputStream = new LineBufferingOutputStream(action, 8);
    context.checking(new Expectations() {

        {
            one(action).text("-");
            one(action).text("-");
        }
    });
    outputStream.write("--".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)41 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