alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (JmsDestinationAccessorTests.java)

This example Spring Framework source code file (JmsDestinationAccessorTests.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

change, connectionfactory, connectionfactory, exception, exception, javadoc, jmsdestinationaccessor, jmsdestinationaccessor, jmsdestinationaccessortests, queues, stubjmsdestinationaccessor, stubjmsdestinationaccessor, testcase, the

The Spring Framework JmsDestinationAccessorTests.java source code

package org.springframework.jms.support.destination;

import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.test.AssertThrows;

import javax.jms.ConnectionFactory;

/**
 * Unit tests for the {@link JmsDestinationAccessor} class.
 *
 * @author Rick Evans
 */
public final class JmsDestinationAccessorTests extends TestCase {

    public void testChokesIfDestinationResolverIsetToNullExplcitly() throws Exception {
        MockControl mockConnectionFactory = MockControl.createControl(ConnectionFactory.class);
        final ConnectionFactory connectionFactory = (ConnectionFactory) mockConnectionFactory.getMock();
        mockConnectionFactory.replay();

        new AssertThrows(IllegalArgumentException.class) {
            public void test() throws Exception {
                JmsDestinationAccessor accessor = new StubJmsDestinationAccessor();
                accessor.setConnectionFactory(connectionFactory);
                accessor.setDestinationResolver(null);
                accessor.afterPropertiesSet();
            }
        }.runTest();

        mockConnectionFactory.verify();
    }

    public void testSessionTransactedModeReallyDoesDefaultToFalse() throws Exception {
        JmsDestinationAccessor accessor = new StubJmsDestinationAccessor();
        assertFalse("The [pubSubDomain] property of JmsDestinationAccessor must default to " +
                "false (i.e. Queues are used by default). Change this test (and the " +
                "attendant Javadoc) if you have changed the default.",
                accessor.isPubSubDomain());
    }

    private static class StubJmsDestinationAccessor extends JmsDestinationAccessor {
    }
}

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework JmsDestinationAccessorTests.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.