Package org.springframework.test

Examples of org.springframework.test.AssertThrows


      }
    }.runTest();
  }

  public void testMulticasterNullCollectionClass() {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        AbstractApplicationEventMulticaster mc = getMulticaster();
        mc.setCollectionClass(null);
      }
    }.runTest();
View Full Code Here


* @author Rick Evans
*/
public final class ModelMBeanNotificationPublisherTests extends TestCase {

  public void testCtorWithNullMBean() throws Exception {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        new ModelMBeanNotificationPublisher(null, createObjectName(), this);
      }
    }.runTest();
  }
View Full Code Here

      }
    }.runTest();
  }

  public void testCtorWithNullObjectName() throws Exception {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        new ModelMBeanNotificationPublisher(new SpringModelMBean(), null, this);
      }
    }.runTest();
  }
View Full Code Here

      }
    }.runTest();
  }

  public void testCtorWithNullManagedResource() throws Exception {
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        new ModelMBeanNotificationPublisher(new SpringModelMBean(), createObjectName(), null);
      }
    }.runTest();
  }
View Full Code Here

  }

  public void testSendNullNotification() throws Exception {
    final NotificationPublisher publisher
        = new ModelMBeanNotificationPublisher(new SpringModelMBean(), createObjectName(), this);
    new AssertThrows(IllegalArgumentException.class) {
      public void test() throws Exception {
        publisher.sendNotification(null);
      }
    }.runTest();
  }
View Full Code Here

public class AssertTests extends TestCase {

    public void testInstanceOf() {
        final Set set = new HashSet();
        Assert.isInstanceOf(HashSet.class, set);
        new AssertThrows(IllegalArgumentException.class, "a hash map is not a set") {
            public void test() throws Exception {
                Assert.isInstanceOf(HashMap.class, set);
            }
        }.runTest();
    }
View Full Code Here

    public void testIsNullDoesNotThrowExceptionIfArgumentIsNull() {
        Assert.isNull(null);
    }

    public void testIsNullThrowsExceptionIfArgumentIsNotNull() {
        new AssertThrows(IllegalArgumentException.class, "object is not null") {
            public void test() throws Exception {
                Assert.isNull(new Object());
            }
        }.runTest();
    }
View Full Code Here

            }
        }.runTest();
    }

    public void testIsNullThrowsExceptionIfArgumentIsNotNullWithMessage() {
        new AssertThrows(IllegalArgumentException.class, "object is not null") {
            public void test() throws Exception {
                Assert.isNull(new Object(), "Bla");
            }

            protected void checkExceptionExpectations(Exception actualException) {
View Full Code Here

            }
        }.runTest();
    }

    public void testIsTrueWithFalseExpressionThrowsException() throws Exception {
        new AssertThrows(IllegalArgumentException.class) {
            public void test() throws Exception {
                Assert.isTrue(false);
            }
        }.runTest();
    }
View Full Code Here

    public void testIsTrueWithTrueExpressionSunnyDay() throws Exception {
        Assert.isTrue(true);
    }

    public void testHasLengthWithNullStringThrowsException() throws Exception {
        new AssertThrows(IllegalArgumentException.class) {
            public void test() throws Exception {
                Assert.hasLength(null);
            }
        }.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.