Package mockit

Examples of mockit.Expectations


        mxLookup.queryMxTargets();
    }

    @Test()
    public void testDifferentPriority() throws MxLookupException {
        new Expectations() {
            {
                lookup.run();
                result = new MXRecord[] { HOST2_PRIORITY20, HOST1_PRIORITY10 };
            }
View Full Code Here


                HOST2_EXAMPLE_COM_NAME }, targets);
    }

    @Test()
    public void testSamePriority() throws MxLookupException {
        new Expectations() {
            {
                lookup.run();
                result = new MXRecord[] { HOST1_PRIORITY10, HOST2_PRIORITY10 };
            }
View Full Code Here

        assertTrue(sameElements(expected, result));
    }

    @Test()
    public void testSamePriorityReallyShuffled() throws MxLookupException {
        new Expectations() {
            {
                lookup.run();
                result =
                        new MXRecord[] { HOST1_PRIORITY10, HOST2_PRIORITY10,
                                HOST3_PRIORITY10, HOST4_PRIORITY10 };
View Full Code Here

    @Test
    public void testDelayDsn() throws LocalMailSystemException {
        retryPolicy.addDelayReportPoint(1);

        new Expectations() {
            {
                onInstance(dsnTransmitter).transmit((Mail) any);
                onInstance(retryTransmitter).transmit((Mail) any);
            }
        };
View Full Code Here

    @Test
    public void testNoDelayDsn() throws LocalMailSystemException {
        retryPolicy.addDelayReportPoint(2);

        new Expectations() {
            {
                onInstance(retryTransmitter).transmit((Mail) any);
            }
        };
View Full Code Here

        };
    }

    @Test
    public void testMailPostponedFirst() throws Exception {
        new Expectations() {
            {
                onInstance(retryTransmitter).transmit((Mail) any);
                forEachInvocation = new Object() {
                    @SuppressWarnings("unused")
                    void validate(Mail mail) {
View Full Code Here

        retryPolicy.actOnPostponeRequired(mail, postponeException);
    }

    @Test
    public void testMailPostponedRepeatedly() throws Exception {
        new Expectations() {
            {
                onInstance(retryTransmitter).transmit((Mail) any);
                forEachInvocation = new Object() {
                    @SuppressWarnings("unused")
                    void validate(Mail mail) {
View Full Code Here

        sender.transmit(mail, IP1);
    }

    @Test
    public void testConnectionRegistryMaintenance() throws Exception {
        new Expectations() {
            {
                outgoingConnectionsRegistry.openConnection(IP1);
                outgoingConnectionsRegistry.releaseConnection(IP1);
            }
        };
View Full Code Here

        sender.transmit(mail, IP1);
    }

    @Test(expected = PostponeException.class)
    public void testPostponedConnection() throws Exception {
        new Expectations() {
            {
                outgoingConnectionsRegistry.openConnection(IP1);
                result = POSTPONE_EXCEPTION;
                outgoingConnectionsRegistry.releaseConnection(IP1);
            }
View Full Code Here

    }

    @Test
    public void testSendToAddressLiteralVerifyNoDns() throws SendException,
            RecipientsWereRejectedException, PostponeException {
        new Expectations() {
            {
                mxLookup.queryMxTargets();
                times = 0;

                addressLookup.queryAddresses();
View Full Code Here

TOP

Related Classes of mockit.Expectations

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.