Tibor17 commented on a change in pull request #285:
URL: https://github.com/apache/maven-surefire/pull/285#discussion_r414128609
##########
File path:
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -956,21 +979,7 @@ private Toolchain getToolchain() throws
MojoFailureException
if ( getJdkToolchain() != null )
{
- Method getToolchainsMethod = tryGetMethod( ToolchainManager.class,
"getToolchains",
- MavenSession.class, String.class, Map.class );
- if ( getToolchainsMethod != null )
- {
- //noinspection unchecked
- List<Toolchain> tcs = (List<Toolchain>) invokeMethodWithArray(
getToolchainManager(),
- getToolchainsMethod, getSession(), "jdk",
getJdkToolchain() );
- if ( tcs.isEmpty() )
- {
- throw new MojoFailureException(
- "Requested toolchain specification did not match any
configured toolchain: "
- + getJdkToolchain() );
- }
- tc = tcs.get( 0 );
- }
+ tc = getToolchainMaven33x( ToolchainManager.class,
getToolchainManager(), getSession(), getJdkToolchain() );
Review comment:
@akomakom
We need to cover this line, and here the mocks would really help. Mock
private static method and verifying that it was called and returns null and the
fallback should be called:
`getToolchainManager().getToolchainFromBuildContext( "jdk", getSession() )`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]