Apply "instanceof pattern matching" in remainder of spring-test module

See gh-30067
This commit is contained in:
Sam Brannen 2023-03-06 17:49:26 +01:00
parent eea000d034
commit fa95bf4dc1
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -340,8 +340,8 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
try {
Method getDataSourceMethod = transactionManager.getClass().getMethod("getDataSource");
Object obj = ReflectionUtils.invokeMethod(getDataSourceMethod, transactionManager);
if (obj instanceof DataSource) {
return (DataSource) obj;
if (obj instanceof DataSource dataSource) {
return dataSource;
}
}
catch (Exception ex) {