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