Skip to content

Support Verifying Errors with @ContextConfiguration at method level [SPR-15034] #19600

Closed
@spring-projects-issues

Description

@spring-projects-issues

Rob Winch opened SPR-15034 and commented

It would be nice if #16647 could support verifying errors. For example something like this:

@Test(expected = BeanDefinitionParsingException.class)
@ContextConfiguration("classpath:/just-this-method.xml")
public void testBeanDefinitionParsingException() {}

It would also be nice if we could access the entire Exception for verifying the description / caused by, etc.

@Test
@ContextConfiguration("classpath:/just-this-method.xml")
public void testBeanDefinitionParsingException(@ExpectedException BeanDefinitionParsingException expected) {
    assertThat(expected).hasDescription("Ooops");
}

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test modulestatus: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions