Skip to content

DefaultNamespaceHandlerResolverTests.testResolveInvalidHandler doesn't pass #22994

@philwebb

Description

@philwebb

Whilst migrating DefaultNamespaceHandlerResolverTests.testResolveInvalidHandler to AssertJ I discovered the current tests doesn't fail as expected.

@Test
public void testResolveInvalidHandler() throws Exception {
	String mappingPath = "org/springframework/beans/factory/xml/support/invalid.properties";
	try {
		new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), mappingPath);
		fail("Should not be able to map a class that doesn't implement NamespaceHandler");
	}
	catch (Throwable expected) {
	}
}

The constructor does not actually throw an exception, the fail method is called but the AssertionError is then swallowed by the catch block so the test passes.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions