|
|
3bca76 |
From 6b5e263ebd03be9551c4e6aa394ac2334fff7c03 Mon Sep 17 00:00:00 2001
|
|
|
3bca76 |
From: Michael Simacek <msimacek@redhat.com>
|
|
|
3bca76 |
Date: Tue, 13 Mar 2018 11:49:16 +0100
|
|
|
3bca76 |
Subject: [PATCH 3/3] Revert "[ MNG-6335] Update Mockito to 2.12.0"
|
|
|
3bca76 |
|
|
|
3bca76 |
This reverts commit a03489b67d04a4b014ff5d1c151b331a39bf100b.
|
|
|
3bca76 |
---
|
|
|
3bca76 |
.../DefaultToolchainManagerPrivateTest.java | 15 +++++++++------
|
|
|
3bca76 |
.../toolchain/DefaultToolchainManagerTest.java | 4 ++--
|
|
|
3bca76 |
.../building/DefaultToolchainsBuilderTest.java | 14 +++++++-------
|
|
|
3bca76 |
maven-embedder/pom.xml | 1 -
|
|
|
3bca76 |
pom.xml | 2 +-
|
|
|
3bca76 |
5 files changed, 19 insertions(+), 17 deletions(-)
|
|
|
3bca76 |
|
|
|
3bca76 |
diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java
|
|
|
3bca76 |
index c937564..1e48441 100644
|
|
|
3bca76 |
--- a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java
|
|
|
3bca76 |
+++ b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivateTest.java
|
|
|
3bca76 |
@@ -20,7 +20,8 @@ package org.apache.maven.toolchain;
|
|
|
3bca76 |
*/
|
|
|
3bca76 |
|
|
|
3bca76 |
import static org.junit.Assert.assertEquals;
|
|
|
3bca76 |
-import static org.mockito.ArgumentMatchers.anyString;
|
|
|
3bca76 |
+import static org.junit.Assert.fail;
|
|
|
3bca76 |
+import static org.mockito.Matchers.anyString;
|
|
|
3bca76 |
import static org.mockito.Mockito.mock;
|
|
|
3bca76 |
import static org.mockito.Mockito.never;
|
|
|
3bca76 |
import static org.mockito.Mockito.verify;
|
|
|
3bca76 |
@@ -144,8 +145,9 @@ public class DefaultToolchainManagerPrivateTest
|
|
|
3bca76 |
verify( logger, never() ).error( anyString() );
|
|
|
3bca76 |
assertEquals( 2, toolchains.length );
|
|
|
3bca76 |
}
|
|
|
3bca76 |
-
|
|
|
3bca76 |
- @Test
|
|
|
3bca76 |
+
|
|
|
3bca76 |
+ @SuppressWarnings( "unchecked" )
|
|
|
3bca76 |
+ @Test( expected = MisconfiguredToolchainException.class )
|
|
|
3bca76 |
public void testMisconfiguredToolchain()
|
|
|
3bca76 |
throws Exception
|
|
|
3bca76 |
{
|
|
|
3bca76 |
@@ -153,11 +155,12 @@ public class DefaultToolchainManagerPrivateTest
|
|
|
3bca76 |
MavenSession session = mock( MavenSession.class );
|
|
|
3bca76 |
MavenExecutionRequest req = new DefaultMavenExecutionRequest();
|
|
|
3bca76 |
when( session.getRequest() ).thenReturn( req );
|
|
|
3bca76 |
+ when(toolchainFactory_basicType.createDefaultToolchain()).thenThrow( MisconfiguredToolchainException.class );
|
|
|
3bca76 |
|
|
|
3bca76 |
// execute
|
|
|
3bca76 |
- ToolchainPrivate[] basics = toolchainManager.getToolchainsForType("basic", session);
|
|
|
3bca76 |
-
|
|
|
3bca76 |
+ toolchainManager.getToolchainsForType( "basic", session );
|
|
|
3bca76 |
+
|
|
|
3bca76 |
// verify
|
|
|
3bca76 |
- assertEquals( 0, basics.length );
|
|
|
3bca76 |
+ fail( "Should exit with a MisconfiguredToolchainException" );
|
|
|
3bca76 |
}
|
|
|
3bca76 |
}
|
|
|
3bca76 |
diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java
|
|
|
3bca76 |
index 84444c0..6e85c42 100644
|
|
|
3bca76 |
--- a/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java
|
|
|
3bca76 |
+++ b/maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java
|
|
|
3bca76 |
@@ -20,6 +20,7 @@ package org.apache.maven.toolchain;
|
|
|
3bca76 |
*/
|
|
|
3bca76 |
|
|
|
3bca76 |
import static org.junit.Assert.assertEquals;
|
|
|
3bca76 |
+import static org.mockito.Matchers.anyMap;
|
|
|
3bca76 |
import static org.mockito.Matchers.isA;
|
|
|
3bca76 |
import static org.mockito.Mockito.mock;
|
|
|
3bca76 |
import static org.mockito.Mockito.verify;
|
|
|
3bca76 |
@@ -38,7 +39,6 @@ import org.apache.maven.toolchain.model.ToolchainModel;
|
|
|
3bca76 |
import org.codehaus.plexus.logging.Logger;
|
|
|
3bca76 |
import org.junit.Before;
|
|
|
3bca76 |
import org.junit.Test;
|
|
|
3bca76 |
-import org.mockito.ArgumentMatchers;
|
|
|
3bca76 |
import org.mockito.InjectMocks;
|
|
|
3bca76 |
import org.mockito.Mock;
|
|
|
3bca76 |
import org.mockito.MockitoAnnotations;
|
|
|
3bca76 |
@@ -142,7 +142,7 @@ public class DefaultToolchainManagerTest
|
|
|
3bca76 |
executionRequest.setToolchains( toolchainModels );
|
|
|
3bca76 |
when( session.getRequest() ).thenReturn( executionRequest );
|
|
|
3bca76 |
ToolchainPrivate basicPrivate = mock( ToolchainPrivate.class );
|
|
|
3bca76 |
- when( basicPrivate.matchesRequirements( ArgumentMatchers.<String, String>anyMap() ) ).thenReturn( false ).thenReturn( true );
|
|
|
3bca76 |
+ when( basicPrivate.matchesRequirements( anyMap() ) ).thenReturn( false ).thenReturn( true );
|
|
|
3bca76 |
when( toolchainFactory_basicType.createToolchain( isA( ToolchainModel.class ) ) ).thenReturn( basicPrivate );
|
|
|
3bca76 |
|
|
|
3bca76 |
List<Toolchain> toolchains =
|
|
|
3bca76 |
diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java
|
|
|
3bca76 |
index fc530df..80fca09 100644
|
|
|
3bca76 |
--- a/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java
|
|
|
3bca76 |
+++ b/maven-core/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java
|
|
|
3bca76 |
@@ -21,7 +21,8 @@ package org.apache.maven.toolchain.building;
|
|
|
3bca76 |
|
|
|
3bca76 |
import static org.junit.Assert.assertEquals;
|
|
|
3bca76 |
import static org.junit.Assert.assertNotNull;
|
|
|
3bca76 |
-import static org.mockito.ArgumentMatchers.any;
|
|
|
3bca76 |
+import static org.mockito.Matchers.any;
|
|
|
3bca76 |
+import static org.mockito.Matchers.anyMap;
|
|
|
3bca76 |
import static org.mockito.Mockito.when;
|
|
|
3bca76 |
|
|
|
3bca76 |
import java.io.IOException;
|
|
|
3bca76 |
@@ -34,7 +35,6 @@ import org.apache.maven.toolchain.model.PersistedToolchains;
|
|
|
3bca76 |
import org.apache.maven.toolchain.model.ToolchainModel;
|
|
|
3bca76 |
import org.junit.Before;
|
|
|
3bca76 |
import org.junit.Test;
|
|
|
3bca76 |
-import org.mockito.ArgumentMatchers;
|
|
|
3bca76 |
import org.mockito.InjectMocks;
|
|
|
3bca76 |
import org.mockito.Mock;
|
|
|
3bca76 |
import org.mockito.MockitoAnnotations;
|
|
|
3bca76 |
@@ -78,7 +78,7 @@ public class DefaultToolchainsBuilderTest
|
|
|
3bca76 |
toolchain.setType( "TYPE" );
|
|
|
3bca76 |
toolchain.addProvide( "key", "user_value" );
|
|
|
3bca76 |
userResult.addToolchain( toolchain );
|
|
|
3bca76 |
- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.<String, Object>anyMap()) ).thenReturn( userResult );
|
|
|
3bca76 |
+ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( userResult );
|
|
|
3bca76 |
|
|
|
3bca76 |
ToolchainsBuildingResult result = toolchainBuilder.build( request );
|
|
|
3bca76 |
assertNotNull( result.getEffectiveToolchains() );
|
|
|
3bca76 |
@@ -101,7 +101,7 @@ public class DefaultToolchainsBuilderTest
|
|
|
3bca76 |
toolchain.setType( "TYPE" );
|
|
|
3bca76 |
toolchain.addProvide( "key", "global_value" );
|
|
|
3bca76 |
globalResult.addToolchain( toolchain );
|
|
|
3bca76 |
- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.<String, Object>anyMap()) ).thenReturn( globalResult );
|
|
|
3bca76 |
+ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( globalResult );
|
|
|
3bca76 |
|
|
|
3bca76 |
ToolchainsBuildingResult result = toolchainBuilder.build( request );
|
|
|
3bca76 |
assertNotNull( result.getEffectiveToolchains() );
|
|
|
3bca76 |
@@ -131,7 +131,7 @@ public class DefaultToolchainsBuilderTest
|
|
|
3bca76 |
globalToolchain.setType( "TYPE" );
|
|
|
3bca76 |
globalToolchain.addProvide( "key", "global_value" );
|
|
|
3bca76 |
globalResult.addToolchain( globalToolchain );
|
|
|
3bca76 |
- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.<String, Object>anyMap()) ).thenReturn( globalResult ).thenReturn( userResult );
|
|
|
3bca76 |
+ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenReturn( globalResult ).thenReturn( userResult );
|
|
|
3bca76 |
|
|
|
3bca76 |
ToolchainsBuildingResult result = toolchainBuilder.build( request );
|
|
|
3bca76 |
assertNotNull( result.getEffectiveToolchains() );
|
|
|
3bca76 |
@@ -150,7 +150,7 @@ public class DefaultToolchainsBuilderTest
|
|
|
3bca76 |
ToolchainsBuildingRequest request = new DefaultToolchainsBuildingRequest();
|
|
|
3bca76 |
request.setGlobalToolchainsSource( new StringSource( "" ) );
|
|
|
3bca76 |
ToolchainsParseException parseException = new ToolchainsParseException( "MESSAGE", 4, 2 );
|
|
|
3bca76 |
- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.<String, Object>anyMap()) ).thenThrow( parseException );
|
|
|
3bca76 |
+ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenThrow( parseException );
|
|
|
3bca76 |
|
|
|
3bca76 |
try
|
|
|
3bca76 |
{
|
|
|
3bca76 |
@@ -169,7 +169,7 @@ public class DefaultToolchainsBuilderTest
|
|
|
3bca76 |
ToolchainsBuildingRequest request = new DefaultToolchainsBuildingRequest();
|
|
|
3bca76 |
request.setGlobalToolchainsSource( new StringSource( "", "LOCATION" ) );
|
|
|
3bca76 |
IOException ioException = new IOException( "MESSAGE" );
|
|
|
3bca76 |
- when( toolchainsReader.read( any( InputStream.class ), ArgumentMatchers.<String, Object>anyMap()) ).thenThrow( ioException );
|
|
|
3bca76 |
+ when( toolchainsReader.read( any( InputStream.class ), anyMap() ) ).thenThrow( ioException );
|
|
|
3bca76 |
|
|
|
3bca76 |
try
|
|
|
3bca76 |
{
|
|
|
3bca76 |
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
|
|
|
3bca76 |
index 8a00565..2a9668b 100644
|
|
|
3bca76 |
--- a/maven-embedder/pom.xml
|
|
|
3bca76 |
+++ b/maven-embedder/pom.xml
|
|
|
3bca76 |
@@ -141,7 +141,6 @@ under the License.
|
|
|
3bca76 |
<dependency>
|
|
|
3bca76 |
<groupId>org.mockito</groupId>
|
|
|
3bca76 |
<artifactId>mockito-core</artifactId>
|
|
|
3bca76 |
- <scope>test</scope>
|
|
|
3bca76 |
</dependency>
|
|
|
3bca76 |
<dependency>
|
|
|
3bca76 |
<groupId>org.fusesource.jansi</groupId>
|
|
|
3bca76 |
diff --git a/pom.xml b/pom.xml
|
|
|
3bca76 |
index ef1d0b0..77b3395 100644
|
|
|
3bca76 |
--- a/pom.xml
|
|
|
3bca76 |
+++ b/pom.xml
|
|
|
3bca76 |
@@ -53,7 +53,7 @@ under the License.
|
|
|
3bca76 |
<commonsCliVersion>1.4</commonsCliVersion>
|
|
|
3bca76 |
<commonsLangVersion>3.5</commonsLangVersion>
|
|
|
3bca76 |
<junitVersion>4.12</junitVersion>
|
|
|
3bca76 |
- <mockitoVersion>2.12.0</mockitoVersion>
|
|
|
3bca76 |
+ <mockitoVersion>1.10.19</mockitoVersion>
|
|
|
3bca76 |
<plexusVersion>1.7.1</plexusVersion>
|
|
|
3bca76 |
<plexusInterpolationVersion>1.24</plexusInterpolationVersion>
|
|
|
3bca76 |
<plexusUtilsVersion>3.1.0</plexusUtilsVersion>
|
|
|
3bca76 |
--
|
|
|
3bca76 |
2.17.1
|
|
|
3bca76 |
|