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