jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Angela Schreiber (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (OAK-8650) PrincipalProviderTest fails with java 14
Date Tue, 01 Oct 2019 14:47:00 GMT

    [ https://issues.apache.org/jira/browse/OAK-8650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16942030#comment-16942030
] 

Angela Schreiber edited comment on OAK-8650 at 10/1/19 2:46 PM:
----------------------------------------------------------------

[~reschke], all 3 tests have in common that they call a 'default' method of the {{PrincipalProvider}}
interface. For some reason with older java versions using {{Mockito.doCallRealMethod()}} works
for methods on interfaces that come with a default implementation, but it is considered 'abstract'
(like methods that don't have a default impl) in java 14.
while it could be fixed by creating anonymous {{PrincipalProvider}} for the test case (see
patch), i would have preferred the mock-style. and obviously would be curious what exactly
is the reason for that changed behavior.


was (Author: anchela):
[~reschke], all 3 tests have in common that they call a 'default' method of the {{PrincipalProvider}}
interface. For some reason with older java versions using {{Mockito.doCallRealMethod()}} works
for methods on interfaces that come with a default implementation, but it is considered 'abstract'
(like methods that don't have a default impl) in java 14.
while it could be fixed by creating anonymous {{PrincipalProvider}} for the test case, i would
have preferred the mock-style. and obviously would be curious what exactly is the reason for
that changed behavior.

> PrincipalProviderTest fails with java 14
> ----------------------------------------
>
>                 Key: OAK-8650
>                 URL: https://issues.apache.org/jira/browse/OAK-8650
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: security-spi
>            Reporter: Julian Reschke
>            Assignee: Angela Schreiber
>            Priority: Major
>         Attachments: OAK-8650.patch
>
>
> (with the fix for OAK-7358 applies, and jacoco turned off)
> {noformat}
>  [ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.013 s <<<
FAILURE! - in org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest
> [ERROR] testGetItemBasedPrincipal(org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest)
 Time elapsed: 0.012 s  <<< ERROR!
> org.mockito.exceptions.base.MockitoException:Cannot call abstract real method on java
object!
> Calling real methods is only possible when mocking non abstract method.
>   //correct example:
>   when(mockOfConcreteClass.nonAbstractMethod()).thenCallRealMethod();
>         at org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest.testGetItemBasedPrincipal(PrincipalProviderTest.java:36)[ERROR]
testGetMembershipPrincipals(org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest)
 Time elapsed: 0 s  <<< ERROR!
> org.mockito.exceptions.base.MockitoException:Cannot call abstract real method on java
object!
> Calling real methods is only possible when mocking non abstract method.
>   //correct example:
>   when(mockOfConcreteClass.nonAbstractMethod()).thenCallRealMethod();
>         at org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest.testGetMembershipPrincipals(PrincipalProviderTest.java:43)[ERROR]
testNegativeOffset(org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest)
 Time elapsed: 0.001 s  <<< ERROR!
> java.lang.Exception: Unexpected exception, expected<java.lang.IllegalArgumentException>
but was<org.mockito.exceptions.base.MockitoException>
>         at org.apache.jackrabbit.oak.spi.security.principal.PrincipalProviderTest.testNegativeOffset(PrincipalProviderTest.java:51){noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message