Package org.apache.james.imap.processor.fetch

Examples of org.apache.james.imap.processor.fetch.PartialFetchBodyElement$LimitingInputStream


    @Test
    public void testSizeShouldBeNumberOfOctetsWhenSizeMoreWhenStartIsZero()
            throws Exception {
        final long moreThanNumberOfOctets = NUMBER_OF_OCTETS + 1;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 0, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(moreThanNumberOfOctets)));
        }});
        assertEquals(
                "Size is more than number of octets so should be number of octets",
                NUMBER_OF_OCTETS, element.size());
    }
View Full Code Here


    @Test
    public void testSizeShouldBeSizeWhenNumberOfOctetsMoreWhenStartIsZero()
            throws Exception {
        final long lessThanNumberOfOctets = NUMBER_OF_OCTETS - 1;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 0, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(lessThanNumberOfOctets)));
        }});
        assertEquals("Size is less than number of octets so should be size",
                lessThanNumberOfOctets, element.size());
    }
View Full Code Here

    @Test
    public void testWhenStartPlusNumberOfOctetsIsMoreThanSizeSizeShouldBeSizeMinusStart()
            throws Exception {
        final long size = 60;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 10, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(size)));
        }});
        assertEquals("Size is less than number of octets so should be size",
                50, element.size());
    }
View Full Code Here

    @Test
    public void testWhenStartPlusNumberOfOctetsIsLessThanSizeSizeShouldBeNumberOfOctetsMinusStart()
            throws Exception {
        final long size = 100;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 10, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(size)));
        }});
        assertEquals("Size is less than number of octets so should be size",
                90, element.size());
    }
View Full Code Here

    }

    @Test
    public void testSizeShouldBeZeroWhenStartIsMoreThanSize() throws Exception {
        final long size = 100;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 1000, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(size)));
        }});
        assertEquals("Size is less than number of octets so should be size", 0,
                element.size());
    }
View Full Code Here

    @Test
    public void testSizeShouldBeNumberOfOctetsWhenStartMoreThanOctets()
            throws Exception {
        final long size = 2000;
        PartialFetchBodyElement element = new PartialFetchBodyElement(
                mockBodyElement, 1000, NUMBER_OF_OCTETS);
        mockery.checking(new Expectations() {{
            oneOf(mockBodyElement).size();will(returnValue(new Long(size)));
        }});
        assertEquals("Content size is less than start. Size should be zero.",
                NUMBER_OF_OCTETS, element.size());
    }
View Full Code Here

TOP

Related Classes of org.apache.james.imap.processor.fetch.PartialFetchBodyElement$LimitingInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.