[ 
https://issues.apache.org/jira/browse/GEODE-4642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Barbara Pruijn updated GEODE-4642:
----------------------------------
    Fix Version/s: 1.5.0

> PowerMock any() arguments in tests can fail intermittently
> ----------------------------------------------------------
>
>                 Key: GEODE-4642
>                 URL: https://issues.apache.org/jira/browse/GEODE-4642
>             Project: Geode
>          Issue Type: Bug
>            Reporter: Patrick Rhomberg
>            Assignee: Patrick Rhomberg
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.5.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> See the Travis failure of PR #1415: 
> https://travis-ci.org/apache/geode/builds/339119584?utm_source=github_status&utm_medium=notification
> {noformat}
> :geode-core:testPicked up _JAVA_OPTIONS: -Xmx1024m -Xms512m
> org.apache.geode.cache.query.internal.types.TypeUtilsJUnitTest > 
> getRegionEntryTypeShouldReturnTheProperTypeImplementation FAILED
>     org.mockito.exceptions.misusing.InvalidUseOfMatchersException: 
>     Misplaced or misused argument matcher detected here:
>     -> at 
> org.apache.geode.cache.query.internal.types.TypeUtilsJUnitTest.lambda$booleanCompareShouldThrowExceptionIfValuesAreNotInstancesOfBoolean$7(TypeUtilsJUnitTest.java:441)
>     -> at 
> org.apache.geode.cache.query.internal.types.TypeUtilsJUnitTest.lambda$booleanCompareShouldThrowExceptionIfValuesAreNotInstancesOfBoolean$8(TypeUtilsJUnitTest.java:444)
>     -> at 
> org.apache.geode.cache.query.internal.types.TypeUtilsJUnitTest.lambda$booleanCompareShouldThrowExceptionIfValuesAreNotInstancesOfBoolean$9(TypeUtilsJUnitTest.java:447)
>     You cannot use argument matchers outside of verification or stubbing.
>     Examples of correct usage of argument matchers:
>         when(mock.get(anyInt())).thenReturn(null);
>         doThrow(new 
> RuntimeException()).when(mock).someVoidMethod(anyObject());
>         verify(mock).someMethod(contains("foo"))
>     This message may appear after an NullPointerException if the last matcher 
> is returning an object 
>     like any() but the stubbed method signature expect a primitive argument, 
> in this case,
>     use primitive alternatives.
>         when(mock.get(any())); // bad use, will raise NPE
>         when(mock.get(anyInt())); // correct usage use
>     Also, this error might show up because you use argument matchers with 
> methods that cannot be mocked.
>     Following methods *cannot* be stubbed/verified: 
> final/private/equals()/hashCode().
>     Mocking methods declared on non-public parent classes is not supported.
>         at 
> org.apache.geode.cache.query.internal.types.TypeUtilsJUnitTest.getRegionEntryTypeShouldReturnTheProperTypeImplementation(TypeUtilsJUnitTest.java:429)
> 4020 tests completed, 1 failed, 8 skipped
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to