Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
96c6ae0
spelling: additional
jsoref Jun 12, 2019
e7d02ec
spelling: arguably
jsoref Jun 12, 2019
16c1faa
spelling: arthur
jsoref Jun 12, 2019
f64bd22
spelling: available
jsoref Jun 12, 2019
1da3c79
spelling: bytecode
jsoref Jun 12, 2019
a51ab03
spelling: changeable
jsoref Jun 12, 2019
4374552
spelling: classes
jsoref Jun 12, 2019
4c2ead0
spelling: criteria
jsoref Jun 12, 2019
2f3fc0a
spelling: critical
jsoref Jun 12, 2019
3c09666
spelling: delegates
jsoref Jun 12, 2019
3fabd60
spelling: different
jsoref Jun 12, 2019
745dbfd
spelling: erroneous
jsoref Jun 12, 2019
b78f9b7
spelling: exception
jsoref Jun 12, 2019
9e3d265
spelling: exempli gratia (e.g.)
jsoref Jun 12, 2019
6cf36e4
spelling: friendly
jsoref Jun 12, 2019
9abe17b
spelling: GitHub (brand)
jsoref Jun 12, 2019
c2713eb
spelling: accessible
jsoref Jun 12, 2019
f086039
spelling: hierarchy
jsoref Jun 12, 2019
b0c2f46
spelling: implemented
jsoref Jun 12, 2019
556d3a2
spelling: implementers
jsoref Jun 12, 2019
2f5292b
spelling: implicitly
jsoref Jun 12, 2019
c7c8e6f
spelling: impossible
jsoref Jun 12, 2019
e685e98
spelling: initialized
jsoref Jun 12, 2019
4375c83
spelling: instantiated
jsoref Jun 12, 2019
66ea0a2
spelling: insufficient
jsoref Jun 12, 2019
3627fec
spelling: intellij
jsoref Jun 12, 2019
d32cf9a
spelling: internal
jsoref Jun 12, 2019
9c5d843
spelling: initializer
jsoref Jun 12, 2019
333c47a
spelling: instance
jsoref Jun 12, 2019
ff90a2e
spelling: invocation
jsoref Jun 12, 2019
4895b49
spelling: listener
jsoref Jun 13, 2019
08eceed
spelling: location
jsoref Jun 13, 2019
ffbdfde
spelling: member
jsoref Jun 13, 2019
779020d
spelling: message
jsoref Jun 13, 2019
590e396
spelling: method
jsoref Jun 13, 2019
e799c4f
spelling: mockito
jsoref Jun 13, 2019
fa1bc8f
spelling: modifying
jsoref Jun 13, 2019
54b48b0
spelling: objenesis
jsoref Jun 13, 2019
24a3a67
spelling: official
jsoref Jun 13, 2019
c37da18
spelling: overridden
jsoref Jun 13, 2019
df94289
spelling: package
jsoref Jun 13, 2019
e3d03fc
spelling: parameterized
jsoref Jun 13, 2019
08f3d69
spelling: parameters
jsoref Jun 13, 2019
1ffbdc7
spelling: previous
jsoref Jun 13, 2019
c283be1
spelling: primitive
jsoref Jun 13, 2019
e9111bd
spelling: private
jsoref Jun 13, 2019
531b167
spelling: programmatically
jsoref Jun 13, 2019
0335f2e
spelling: proxying
jsoref Jun 13, 2019
4854220
spelling: released
jsoref Jun 13, 2019
87bdeeb
spelling: retrieve
jsoref Jun 13, 2019
9bfa2fd
spelling: sense
jsoref Jun 13, 2019
805df81
spelling: specifying
jsoref Jun 13, 2019
46ca395
spelling: subsequent
jsoref Jun 13, 2019
2694245
spelling: substitute
jsoref Jun 13, 2019
cd442b4
spelling: substitution
jsoref Jun 13, 2019
a602a45
spelling: supplying
jsoref Jun 13, 2019
f8d3552
spelling: suppress
jsoref Jun 13, 2019
5a78b8c
spelling: tracker
jsoref Jun 13, 2019
562890f
spelling: unmodifiable
jsoref Jun 13, 2019
dcf59ac
spelling: virtual
jsoref Jun 13, 2019
5ee1b8e
spelling: want
jsoref Jun 13, 2019
b205c63
spelling: with
jsoref Jun 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Issues should always have a [Short, Self Contained, Correct (Compilable)](http:/

For that matter it's possible to commit [_semantic_ changes](http://lemike-de.tumblr.com/post/79041908218/semantic-commits). _Tests are an asset, so is history_.

_Exemple gratia_:
_Exempli gratia_:
```
Fixes #777 : The new feature
Fixes #777 : Refactors this part of PowerMock to make feature possible
Expand All @@ -66,6 +66,6 @@ Fixes #777 : Refactors this part of PowerMock to make feature possible

* New test methods should follow a snake case convention (`ensure_that_stuff_is_doing_that`), this allows the test name to be fully expressive on intent while still readable.

* Documentation !!! Always document the public API with love. Internals could use some love too but it's argubly not as important. In all cases the code should _auto-document_ itself like any [well designed API](rebased and squashed if necessary, so that each commit clearly changes one things and there are no extraneous fix-ups).
* Documentation !!! Always document the public API with love. Internals could use some love too but it's arguably not as important. In all cases the code should _auto-document_ itself like any [well designed API](rebased and squashed if necessary, so that each commit clearly changes one things and there are no extraneous fix-ups).

* We use (4) spaces instead of tabs. Make sure line ending is Unix style (LF). More on line ending on the [Github help](https://help.github.com/articles/dealing-with-line-endings/).
* We use (4) spaces instead of tabs. Make sure line ending is Unix style (LF). More on line ending on the [GitHub help](https://help.github.com/articles/dealing-with-line-endings/).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ When writing unit tests it is often useful to bypass encapsulation and therefore
Please note that PowerMock is mainly intended for people with expert knowledge in unit testing. Putting it in the hands of junior developers may cause more harm than good.

## News
* 2019-04-21: PowerMock 2.0.2 has been release and avaliable in Maven Central. The release includes fix the [issue](https://github.com/powermock/powermock/issues/979) wiht PowerMock JavaAgent with latest JDK and [security issue](https://github.com/powermock/powermock/issues/973) wiht build script.
* 2019-01-07: PowerMock 2.0.0 has been released. Main changes: offical supporting Mockito 2.x and dropping supporting Mockito 1.x. This release also supports Java 9. Other change read in [release notes](https://github.com/powermock/powermock/releases/tag/powermock-2.0.0).
* 2019-04-21: PowerMock 2.0.2 has been release and available in Maven Central. The release includes fix the [issue](https://github.com/powermock/powermock/issues/979) with PowerMock JavaAgent with latest JDK and [security issue](https://github.com/powermock/powermock/issues/973) with build script.
* 2019-01-07: PowerMock 2.0.0 has been released. Main changes: official supporting Mockito 2.x and dropping supporting Mockito 1.x. This release also supports Java 9. Other change read in [release notes](https://github.com/powermock/powermock/releases/tag/powermock-2.0.0).
* 2017-08-12: PowerMock 1.7.1 has been released with one, but significant change: the old API for verifying static mock has been deprecated and a new one has been added. Old API will be removed in version PowerMock 2.0 due to incompatibility with Mockito Public API.
* 2017-06-16: PowerMock 1.7.0 has been released with support for Mockito 2 (not only beta versions) and new features such as global `@PowerMockIgnore` as well as bug fixes and other improvements. See [release notes](https://github.com/powermock/powermock/releases/tag/powermock-1.7.0) and [change log](https://raw.githubusercontent.com/powermock/powermock/master/docs/changelog.txt) for details.
* 2017-02-03: Johan blogs about how to mock slf4j with PowerMock at his [blog](http://code.haleby.se/2017/02/03/a-case-for-powermock/)
Expand Down
36 changes: 18 additions & 18 deletions docs/changelog.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gradle/shipkit.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ shipkit {

git.tagPrefix = "powermock-"

// fix for Intellj Idea, because IDE does not read env properties from ${user.home}/.profile file on MacOS
// fix for IntelliJ Idea, because IDE does not read env properties from ${user.home}/.profile file on MacOS

gitHub.writeAuthUser = System.getenv("GH_USER")
gitHub.writeAuthToken = System.getenv("GH_WRITE_TOKEN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@

public class EasyMockNewInvocationControl<T> implements NewInvocationControl<IExpectationSetters<T>> {
private final InvocationSubstitute<T> substitute;
private final Class<T> subsitutionType;
private final Class<T> substitutionType;
private boolean hasReplayed;
private boolean hasVerified;

public EasyMockNewInvocationControl(InvocationSubstitute<T> substitute, Class<T> type) {
if (substitute == null) {
throw new IllegalArgumentException("Internal error: substitute cannot be null.");
}
this.subsitutionType = type;
this.substitutionType = type;
this.substitute = substitute;
}

Expand All @@ -58,7 +58,7 @@ public Object invoke(Class<?> type, Object[] args, Class<?>[] sig) throws Except

if (result == null) {
if (mockType == MockType.NICE) {
result = EasyMock.createNiceMock(subsitutionType);
result = EasyMock.createNiceMock(substitutionType);
} else {
throw new IllegalStateException("Must replay class " + type.getName() + " to get configured expectation.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public static void throwAssertionErrorForNewSubstitutionFailure(AssertionError o
* instance of MyClass has been created less or more times than 3.
*/
String message = oldError.getMessage();
final String newSubsitutionMethodName = InvocationSubstitute.class.getDeclaredMethods()[0].getName();
final String newSubstitutionMethodName = InvocationSubstitute.class.getDeclaredMethods()[0].getName();
final String className = InvocationSubstitute.class.getSimpleName();
message = message.replaceAll(className+"."+newSubsitutionMethodName, Matcher.quoteReplacement(type.getName()));
message = message.replaceAll(className+"."+newSubstitutionMethodName, Matcher.quoteReplacement(type.getName()));
message = message.replaceAll("method", "constructor");

throw new AssertionError(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static void mockStatic(Class<?> classMock, @SuppressWarnings("rawtypes")
* <p>
* <pre>
* mockStatic(Listener.class, withSettings()
* .name(&quot;firstListner&quot;).defaultBehavior(RETURNS_SMART_NULLS));
* .name(&quot;firstListener&quot;).defaultBehavior(RETURNS_SMART_NULLS));
* );
* </pre>
* <p>
Expand Down Expand Up @@ -160,7 +160,7 @@ public static <T> T mock(Class<T> classToMock, @SuppressWarnings("rawtypes") Ans
* <p>
* <pre>
* Listener mock = mock(Listener.class, withSettings()
* .name(&quot;firstListner&quot;).defaultBehavior(RETURNS_SMART_NULLS));
* .name(&quot;firstListener&quot;).defaultBehavior(RETURNS_SMART_NULLS));
* );
* </pre>
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.lang.reflect.Method;

/**
* Extension of the standard Mocktio stubber implementation that also support
* Extension of the standard Mockito stubber implementation that also support
* PowerMockito created mocks.
*/
public class PowerMockitoStubberImpl implements PowerMockitoStubber, Stubber {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ public static void throwAssertionErrorForNewSubstitutionFailure(AssertionError o
* whenNew(MyClass.class).thenReturn(myMock).times(3) when in fact an
* instance of MyClass has been created less or more times than 3.
*/
final String newSubsitutionClassName = InvocationSubstitute.class.getSimpleName();
final String newSubsitutionClassNameInMockito = newSubsitutionClassName.substring(0, 1).toLowerCase()
+ newSubsitutionClassName.substring(1);
final String newSubstitutionClassName = InvocationSubstitute.class.getSimpleName();
final String newSubstitutionClassNameInMockito = newSubstitutionClassName.substring(0, 1).toLowerCase()
+ newSubstitutionClassName.substring(1);
String message = oldError.getMessage();
final String newSubsitutionMethodName = InvocationSubstitute.class.getDeclaredMethods()[0].getName();
message = message.replaceAll(newSubsitutionClassNameInMockito + "." + newSubsitutionMethodName, Matcher
final String newSubstitutionMethodName = InvocationSubstitute.class.getDeclaredMethods()[0].getName();
message = message.replaceAll(newSubstitutionClassNameInMockito + "." + newSubstitutionMethodName, Matcher
.quoteReplacement(type.getName()));
message = message.replaceAll("method", "constructor");
throw new AssertionError(changeMessageContent(message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ClassLoaderUtil {

/**
* Loads a class with a specific classloader, wraps the
* {@link ClassNotFoundException} in a runtime exeception.
* {@link ClassNotFoundException} in a runtime exception.
*/
@SuppressWarnings("unchecked")
public static <T> Class<T> loadClass(Class<T> type, ClassLoader classloader) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MethodReplaceStrategyImpl(Method method) {
@Override
public void with(Method method) {
if (method == null) {
throw new IllegalArgumentException("A metod cannot be replaced with null.");
throw new IllegalArgumentException("A method cannot be replaced with null.");
}
if (!Modifier.isStatic(this.method.getModifiers())) {
throw new IllegalArgumentException(String.format("Replace requires static methods, '%s' is not static", this.method));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ private boolean isJavaReflectClass(Class<?> cls) {

private <T> boolean isSerializableCandidate(Class<T> targetClass, Object source) {
return isStandardJavaType(targetClass)
&& (isSerializable(targetClass) || isImpliticlySerializable(targetClass))
&& (isSerializable(targetClass) || isImplicitlySerializable(targetClass))
&& !Map.class.isAssignableFrom(source.getClass())
&& !Iterable.class.isAssignableFrom(source.getClass());
}

private static boolean isImpliticlySerializable(Class<?> cls) {
private static boolean isImplicitlySerializable(Class<?> cls) {
return cls.isPrimitive();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class PowerMockInternalException extends RuntimeException{

private static final String MESSAGE = "PowerMock internal error has happened. This exception is thrown in unexpected cases, that normally should never happen. Please, report about the issue to PowerMock issues tacker. ";
private static final String MESSAGE = "PowerMock internal error has happened. This exception is thrown in unexpected cases, that normally should never happen. Please, report about the issue to PowerMock issues tracker. ";

public PowerMockInternalException(final Throwable cause) {
super(MESSAGE, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private ConstructorMockGetawayCall(final Method getawayMethod,
this.targetParameters = targetParameters;
}

private List<StackManipulation> loadSignatureParametersClasess() {
private List<StackManipulation> loadSignatureParametersClasses() {
List<StackManipulation> constructorSignature = new ArrayList<StackManipulation>();

for (InDefinedShape targetParameter : targetParameters) {
Expand Down Expand Up @@ -133,7 +133,7 @@ public boolean isValid() {
@Override
public Size apply(final MethodVisitor mv, final Context implementationContext) {
List<StackManipulation> loadTargetParameters = loadArgumentsFromVariable();
List<StackManipulation> constructorSignature = loadSignatureParametersClasess();
List<StackManipulation> constructorSignature = loadSignatureParametersClasses();

return new Compound(
ClassConstant.of(targetType),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*
* @author Johan Haleby
* @author Jan Kronquist
* @author Artur Zagretdinov
* @author Arthur Zagretdinov
*
* @see MockClassLoaderConfiguration
* @see ClassLoader#getSystemClassLoader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* {@link #value()} list.
* <p>
* Sometimes you need to prepare inner classes for testing, this can be done by
* suppling the fully-qualified name of the inner-class that should be mocked to
* supplying the fully-qualified name of the inner-class that should be mocked to
* the {@link #fullyQualifiedNames()} list.
* <p>
* You can also prepare whole packages for test by using wildcards:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* {@link #value()} list.
* <p>
* Sometimes you need to prepare inner classes for testing, this can be done by
* suppling the fully-qualified name of the inner-class that should be mocked to
* supplying the fully-qualified name of the inner-class that should be mocked to
* the {@link #fullyQualifiedNames()} list.
*
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void edit(NewExpr e) throws CannotCompileException {
"} else {" +
" $_ = $proceed($$);" +
"}";
// TODO Change to objenisis instead
// TODO Change to objenesis instead
e.replace(code);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ForMethodsJavaAssistTestClassTransformer extends JavaAssistTestClas

private final Collection<Method> testMethodsThatRunOnOtherClassLoaders;
/**
* Is lazily initilized because of
* Is lazily initialized because of
* AbstractTestSuiteChunkerImpl#chunkClass(Class)
*/
private Collection<String> methodsThatRunOnOtherClassLoaders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public interface MockPolicyInterceptionSettings {
* @deprecated Use {@link #stubMethod(Method, Object)} instead.
*/
@Deprecated
void setSubtituteReturnValues(Map<Method, Object> substituteReturnValues);
void setSubstituteReturnValues(Map<Method, Object> substituteReturnValues);

/**
* Add a method that should be intercepted and return another value (
Expand All @@ -104,7 +104,7 @@ public interface MockPolicyInterceptionSettings {
* @deprecated Use {@link #stubMethod(Method, Object)} instead.
*/
@Deprecated
void addSubtituteReturnValue(Method method, Object returnObject);
void addSubstituteReturnValue(Method method, Object returnObject);

/**
* Set specific fields that should be suppressed upon invocation. Note that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ public String[] getFieldTypesToSuppress() {
}

@Override
public void addSubtituteReturnValue(Method method, Object returnObject) {
public void addSubstituteReturnValue(Method method, Object returnObject) {
substituteReturnValues.put(method, returnObject);
}

@Override
public void setSubtituteReturnValues(Map<Method, Object> substituteReturnValues) {
public void setSubstituteReturnValues(Map<Method, Object> substituteReturnValues) {
this.substituteReturnValues = substituteReturnValues;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.lang.reflect.Method;

/**
* Implementors of this interface that must provide the ability to notify
* Implementers of this interface that must provide the ability to notify
* PowerMock test listeners with the events as specified by the methods declared
* in this interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void should_load_defined_class() throws Exception {
}

@Test
public void should_ignore_pagackage_added_powerMockIgnore_Annotated() throws Exception {
public void should_ignore_package_added_powerMockIgnore_Annotated() throws Exception {
MockClassLoader mockClassLoader = mockClassLoaderFactory.getInstance(new String[]{"org.ikk.Jux"});

MockClassLoaderConfiguration configuration = mockClassLoader.getConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package com.sun.tools.attach;

/**
* Thrown by {@link VirtualMachine#attach VirtalMachine.attach} when attempting to attach to a Java
* Thrown by {@link VirtualMachine#attach VirtualMachine.attach} when attempting to attach to a Java
* virtual machine for which a compatible {@link com.sun.tools.attach.spi.AttachProvider
* AttachProvider} does not exist. It is also thrown by {@link
* com.sun.tools.attach.spi.AttachProvider#attachVirtualMachine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
* (using the zero-arg constructor) at the first invocation of this method.
* The list returned by the first invocation of this method is the list
* of providers. Subsequent invocations of this method return a list of the same
* providers. The list is unmodifable.</p>
* providers. The list is unmodifiable.</p>
*
* @return A list of the installed attach providers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void loadAgent(String agent, String options)
int rc = x.returnValue();
switch (rc) {
case JNI_ENOMEM:
throw new AgentLoadException("Insuffient memory");
throw new AgentLoadException("Insufficient memory");
case ATTACH_ERROR_BADJAR:
throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
case ATTACH_ERROR_NOTONCP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Object create() {
/**
* We proxy the test class in order to be able to clear state after each
* test method invocation. It would be much better to be able to register a
* testng listener programmtically but I cannot find a way to do so.
* testng listener programmatically but I cannot find a way to do so.
*/
private Class<?> createTestClass(Class<?> actualTestClass) throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static void setInternalState(Object object, String fieldName, Object[] va
* Set the value of a field using reflection. This method will traverse the
* super class hierarchy until the first field assignable to the
* <tt>value</tt> type is found. The <tt>value</tt> (or
* <tt>additionaValues</tt> if present) will then be assigned to this field.
* <tt>additionalValues</tt> if present) will then be assigned to this field.
*
* @param object
* the object to modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public java.lang.reflect.Constructor findConstructor() {

// if a constructor is found and it has varargs parameters then the constructor will be used even if
// other constructor is matcher the given arguments. It is done, because when Argument Matchers are used
// arguments passed to the method are null value and it's imposable to determinate whether parameters
// arguments passed to the method are null value and it's impossible to determinate whether parameters
// match to arguments or not.

if (isVarArgConstructorFound()){
Expand Down
Loading