Search in sources :

Example 46 with Expectations

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

Example 47 with Expectations

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

Example 48 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 49 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)

Example 50 with Expectations

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();
}
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