Skip to content
Commits on Source (12)
language: java
jdk:
- openjdk8
sudo: false
cache:
directories:
# Maven
- $HOME/.m2
# Android SDK
- $HOME/android-sdk-dl
- $HOME/android-sdk
......@@ -11,13 +16,13 @@ cache:
install:
# Download and unzip the Android SDK tools (if not already there thanks to the cache mechanism)
- if test ! -e $HOME/android-sdk-dl/tools_r25.2.5-linux.zip ; then curl https://dl.google.com/android/repository/tools_r25.2.5-linux.zip > $HOME/android-sdk-dl/tools_r25.2.5-linux.zip ; fi
- unzip -n $HOME/android-sdk-dl/tools_r25.2.5-linux.zip -d $HOME/android-sdk
- unzip -q -n $HOME/android-sdk-dl/tools_r25.2.5-linux.zip -d $HOME/android-sdk
# Install or update Android SDK components (will not do anything if already up to date thanks to the cache mechanism)
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'tools'
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'platform-tools'
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'build-tools;27.0.1'
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'platforms;android-27'
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'tools' | grep -v = || true
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'platform-tools' | grep -v = || true
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'build-tools;27.0.1' | grep -v = || true
- yes | $HOME/android-sdk/tools/bin/sdkmanager 'platforms;android-27' | grep -v = || true
env:
- ANDROID_HOME=$HOME/android-sdk
script:
......
......@@ -21,8 +21,8 @@ Environment setup
-----------------
I'm using:
- IntelliJ 2017.3 Ultimate (thanks to JetBrains for the license)
- Maven 3.5.0
- IntelliJ 2019.3 Ultimate (thanks to JetBrains for the license)
- Maven 3.6.2
You can also use Eclipse. I tried
- Eclipse 4.5.0 (Mars)
......@@ -73,22 +73,15 @@ To update the versions
- `mvn versions:set -DnewVersion=X.Y -Pall`
- `mvn versions:commit -Pall` if everything is ok, `mvn versions:revert -Pall` otherwise
Configure to deploy to the Sonatype maven repository
Configure to deploy to the Bintray maven repository
----------------------------------------------------
- You will first need to add something like this to your settings.xml
```xml
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>sonatypeuser</username>
<password>sonatypepassword</password>
<id>bintray</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>sonatypeuser</username>
<password>sonatypepassword</password>
</server>
</servers>
```
- Then follow the instructions from the site below to create your key to sign the deployed items
......@@ -96,7 +89,7 @@ http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven
To build the maven site (with spotbugs, checkstyle, jdepends and JavaNCSS reports)
--------------------------------------------------------------------------------------
- You will to give enough memory to maven with 'set MAVEN_OPTS=-Xmx512m' (or setting it as environment variable)
- You will to give enough memory to maven with `export MAVEN_OPTS=-Xmx512m` (or setting it as environment variable)
- Then type `mvn site`
To check dependencies and plugins versions
......
This is a quick fix to remove the second generic parameter that was introduced
in version 4. It breaks backward compatibility and is actually unnecessary.
Add support to Java 13 and JUnit 5.
Change log
----------
* No need to have two generic parameters on EasyMock.createMock ([#237](https://github.com/easymock/easymock/issues/237))
* Upgrade to Objenesis 3.1 ([#250](https://github.com/easymock/easymock/issues/250))
* java.lang.IllegalArgumentException: Unsupported class file major version 57/58 ([#249](https://github.com/easymock/easymock/issues/249))
* Please comply with ASM license when re-distributing ASM ([#247](https://github.com/easymock/easymock/issues/247))
* Add EasyMockExtension class for JUnit 5 compatibility ([#246](https://github.com/easymock/easymock/pull/246))
* JUnit 5 support (extension instead of EasyMockRunner) ([#245](https://github.com/easymock/easymock/issues/245))
* Add getCurrentArgument to get type inference for the returned type ([#243](https://github.com/easymock/easymock/issues/243))
* CglibTest fails on OpenJDK 13 EA. ([#241](https://github.com/easymock/easymock/issues/241))
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.easymock</groupId>
<artifactId>easymock-parent</artifactId>
<version>4.0.2</version>
<version>4.1</version>
</parent>
<artifactId>easymock-bench</artifactId>
......@@ -17,7 +17,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.21</jmh.version>
<jmh.version>1.22</jmh.version>
<uberjar.name>benchmarks</uberjar.name>
</properties>
......
/*
* Copyright 2014-2018 the original author or authors.
* Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
......@@ -7,9 +7,9 @@ org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
......@@ -66,7 +66,8 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>org.easymock</groupId>
<artifactId>easymock-parent</artifactId>
<version>4.0.2</version>
<version>4.1</version>
</parent>
<artifactId>easymock</artifactId>
......@@ -35,7 +35,7 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.9</version>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.ant</groupId>
......@@ -43,18 +43,17 @@
</exclusion>
</exclusions>
</dependency>
<!-- Use version 7.0 to be compliant with Java 11 -->
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.0</version>
<version>7.2</version>
<scope>runtime</scope>
</dependency>
<!-- Used for class mocking -->
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>3.0.1</version>
<version>3.1</version>
</dependency>
<!-- Used for class mocking on Android (cglib replacement) -->
<dependency>
......@@ -62,6 +61,16 @@
<artifactId>dexmaker</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -157,6 +166,17 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<!-- Force junit provider because surefire will choose the testng one if testng is detected -->
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>3.0.0-M3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -44,7 +44,7 @@ public class Capture<T> implements Serializable {
}
/**
* Constructor allowing to select the capture type
* Constructor allowing to select the capture type.
*
* @param type
* capture type
......@@ -54,7 +54,7 @@ public class Capture<T> implements Serializable {
}
/**
* Create a new capture instance that will keep only the last captured value
* Create a new capture instance that will keep only the last captured value.
*
* @param <T> type of the class to be captured
* @return the new capture object
......@@ -64,7 +64,7 @@ public class Capture<T> implements Serializable {
}
/**
* Create a new capture instance with a specific {@link org.easymock.CaptureType}
* Create a new capture instance with a specific {@link org.easymock.CaptureType}.
*
* @param type capture type wanted
* @param <T> type of the class to be captured
......@@ -75,7 +75,7 @@ public class Capture<T> implements Serializable {
}
/**
* Will reset capture to a "nothing captured yet" state
* Will reset capture to a "nothing captured yet" state.
*/
public void reset() {
values.clear();
......@@ -89,7 +89,7 @@ public class Capture<T> implements Serializable {
}
/**
* Return captured value
* Return captured value.
*
* @throws AssertionError
* if nothing was captured yet or if more than one value was
......@@ -108,7 +108,7 @@ public class Capture<T> implements Serializable {
/**
* Return all captured values. It returns the actual list so you can modify
* it's content if needed
* it's content if needed.
*
* @return The currently captured values
*/
......@@ -117,7 +117,7 @@ public class Capture<T> implements Serializable {
}
/**
* Used internally by the EasyMock framework to add a new captured value
* Used internally by the EasyMock framework to add a new captured value.
*
* @param value
* Value captured
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -16,29 +16,29 @@
package org.easymock;
/**
* Defines how arguments will be captured by a <tt>Capture</tt> object
* Defines how arguments will be captured by a <tt>Capture</tt> object.
*
* @author Henri Tremblay
* @see Capture
*/
public enum CaptureType {
/**
* Do not capture anything
* Do not capture anything.
*/
NONE,
/**
* Will capture the argument of the first matching call
* Will capture the argument of the first matching call.
*/
FIRST,
/**
* Will capture the argument of the last matching call
* Will capture the argument of the last matching call.
*/
LAST,
/**
* Will capture, in order, the arguments of each matching calls
* Will capture, in order, the arguments of each matching calls.
*/
ALL
}
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -20,7 +20,7 @@ import java.lang.reflect.Field;
/**
* Class wrapping arguments to create a partial class mock that gets
* instantiated by calling one of its constructors
* instantiated by calling one of its constructors.
*
* @author Henri Tremblay
*/
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -60,7 +60,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*
......@@ -79,7 +79,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -100,7 +100,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object
*
......@@ -121,7 +121,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*
......@@ -138,7 +138,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*
......@@ -157,7 +157,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -177,7 +177,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*
......@@ -197,7 +197,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -216,7 +216,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement.
* the class that the mock object should extend.
* @return a mock builder to create a partial mock
*
* @since 3.4
......@@ -236,7 +236,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @since 3.2
......@@ -258,7 +258,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @since 3.2
......@@ -276,7 +276,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*/
......@@ -295,7 +295,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -314,7 +314,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*/
......@@ -333,7 +333,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -353,7 +353,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
*/
......@@ -373,7 +373,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return the mock object.
* @throws IllegalArgumentException
......@@ -392,7 +392,7 @@ public class EasyMock {
* @param toMock
* the class or interface that should be mocked.
* @param <T>
* the interface that the mock object should implement. It is expected to be of
* the class or interface that the mock object should extend/implement. It is expected to be of
* class {@code toMock}.
* @return a mock builder to create a partial mock
*/
......@@ -2145,6 +2145,11 @@ public class EasyMock {
return result.getArguments();
}
@SuppressWarnings("unchecked")
public static <T> T getCurrentArgument(int index) {
return (T) getCurrentArguments()[index];
}
/**
* By default, a mock is thread safe (unless
* {@link #NOT_THREAD_SAFE_BY_DEFAULT} is set). This method can change this
......
/*
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.easymock;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
/**
* JUnit 5 replaced the previous {@link org.junit.runner.RunWith} annotation
* (which made use of {@link EasyMockRunner}) with the new
* {@link org.junit.jupiter.api.extension.ExtendWith} annotation. @ExtendWith
* allows for multiple extensions to be mixed and used together. This is only
* relevant for JUnit 5.
*
* This is retrieved from https://stackoverflow.com/a/47243856/2152081
* StackOverflow answer provided by https://stackoverflow.com/users/4126968/eee
*/
public class EasyMockExtension implements TestInstancePostProcessor {
@Override
public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception {
EasyMockSupport.injectMocks(testInstance);
}
}
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -29,8 +29,8 @@ public interface IAnswer<T> {
* Is called by EasyMock to answer an expected call. The answer may be to
* return a value, or to throw an exception. The arguments of the call for
* which the answer is generated are available via
* {@link EasyMock#getCurrentArguments()} - be careful here, using the
* arguments is not refactoring-safe.
* {@link EasyMock#getCurrentArgument(int)} or {@link EasyMock#getCurrentArguments()}.
* The former method is preferred since it will infer the argument type.
*
* @return the value to be returned
* @throws Throwable
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2001-2018 the original author or authors.
* Copyright 2001-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......