Skip to content

Spring ACL uses deprecated Mockito methods #6212

@nenaraab

Description

@nenaraab

Summary

Mockito Matchers are deprecated and should be replaced with Mockito ArgumentMatcher.

Example:
public static <T> List<T> anyListOf(Class<T> clazz) is deprecated. With Java 8 this method will be removed in Mockito 3.0. This method is only used for generic friendliness to avoid casting, this is not anymore needed in Java 8.

Deprecated because Java 8 compiler can infer the type now.

Actual Implementation, e.g.

import static org.mockito.Matchers.anyListOf;
...

lookupStrategy.readAclsById(anyListOf(ObjectIdentity.class),
						anyListOf(Sid.class))).thenReturn(result);

Expected Implementation, e.g.

import static org.mockito.ArgumentMatchers.anyList;
...

lookupStrategy.readAclsById(anyList(),
						anyList())).thenReturn(result);

Other example is anyObject, which should be replaced by any or any(Class<T> clazz)

Version

LATEST

Further details

Files affected: JdbcAclServiceTests and AclPermissionEvaluatorTests

Further References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions