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