Package org.springframework.test

Examples of org.springframework.test.AssertThrows


    AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
    beanDefinition.setScope("he put himself so low could hardly look me in the face");

    final DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    factory.registerBeanDefinition("testBean", beanDefinition);
    new AssertThrows(IllegalStateException.class) {
      public void test() throws Exception {
        factory.getBean("testBean");
      }
    }.runTest();
  }
View Full Code Here


  }

  public void testWhereScopeMapHasNullScopeValueInEntrySet() throws Exception {
    new ConfigurableListableBeanFactoryMockTemplate() {
      protected void doTest(final ConfigurableListableBeanFactory factory) {
        new AssertThrows(IllegalArgumentException.class) {
          public void test() throws Exception {
            Map scopes = new HashMap();
            scopes.put(FOO_SCOPE, null);
            CustomScopeConfigurer figurer = new CustomScopeConfigurer();
            figurer.setScopes(scopes);
View Full Code Here

  }

  public void testWhereScopeMapHasNonScopeInstanceInEntrySet() throws Exception {
    new ConfigurableListableBeanFactoryMockTemplate() {
      protected void doTest(final ConfigurableListableBeanFactory factory) {
        new AssertThrows(IllegalArgumentException.class) {
          public void test() throws Exception {
            Map scopes = new HashMap();
            scopes.put(FOO_SCOPE, this); // <-- not a valid value...
            CustomScopeConfigurer figurer = new CustomScopeConfigurer();
            figurer.setScopes(scopes);
View Full Code Here

  }

  public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() throws Exception {
    new ConfigurableListableBeanFactoryMockTemplate() {
      protected void doTest(final ConfigurableListableBeanFactory factory) {
        new AssertThrows(IllegalArgumentException.class) {
          public void test() throws Exception {
            Map scopes = new HashMap();
            scopes.put(this, new NoOpScope()); // <-- not a valid value (the key)...
            CustomScopeConfigurer figurer = new CustomScopeConfigurer();
            figurer.setScopes(scopes);
View Full Code Here

        CommonsLogFactoryBean factory = new CommonsLogFactoryBean();
        assertEquals(Log.class, factory.getObjectType());
    }

    public void testWhenLogNameIsMissing() throws Exception {
        new AssertThrows(IllegalArgumentException.class) {
            public void test() throws Exception {
                CommonsLogFactoryBean factory = new CommonsLogFactoryBean();
                factory.afterPropertiesSet();
            }
        }.runTest();
View Full Code Here

    final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
      protected Object extractMessage(Message message) {
        return message;
      }
    };
    new AssertThrows(InvalidDestinationException.class) {
      public void test() throws Exception {
        adapter.onMessage(sentTextMessage, session);
      }
    }.runTest();
View Full Code Here

    final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
      protected Object extractMessage(Message message) {
        return message;
      }
    };
    new AssertThrows(JMSException.class) {
      public void test() throws Exception {
        adapter.onMessage(sentTextMessage, session);
      }
    }.runTest();
View Full Code Here

    final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
      protected Object extractMessage(Message message) {
        return message;
      }
    };
    new AssertThrows(ListenerExecutionFailedException.class) {
      public void test() throws Exception {
        adapter.onMessage(message, session);
      }
    }.runTest();
View Full Code Here

      protected Object extractMessage(Message message) {
        return message;
      }
    };
    adapter.setMessageConverter(null);
    new AssertThrows(MessageConversionException.class) {
      public void test() throws Exception {
        adapter.onMessage(sentTextMessage, session);
      }
    }.runTest();
View Full Code Here

    assertEquals(url.toExternalForm(), urlEditor.getAsText());
    assertTrue(!url.getProtocol().startsWith("classpath"));
  }

  public void testWithNonExistentResource() throws Exception {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        PropertyEditor urlEditor = new URLEditor();
        urlEditor.setAsText("gonna:/freak/in/the/morning/freak/in/the.evening");
      }
    }.runTest();
View Full Code Here

TOP

Related Classes of org.springframework.test.AssertThrows

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.