Example usage for org.springframework.beans.factory UnsatisfiedDependencyException toString

List of usage examples for org.springframework.beans.factory UnsatisfiedDependencyException toString

Introduction

In this page you can find the example usage for org.springframework.beans.factory UnsatisfiedDependencyException toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.springframework.beans.factory.DefaultListableBeanFactoryTests.java

@Test
public void testConstructorDependencyWithUnresolvableClass() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyWithClassResolution.class);
    bd.getConstructorArgumentValues().addGenericArgumentValue("java.lang.Strin");
    lbf.registerBeanDefinition("test", bd);
    try {/*from   w w  w.  ja va2 s  .  c  o  m*/
        lbf.preInstantiateSingletons();
        fail("Should have thrown UnsatisfiedDependencyException");
    } catch (UnsatisfiedDependencyException expected) {
        assertTrue(expected.toString().contains("java.lang.Strin"));
    }
}