This PR updates Mockito to major version 4 and removes the dependency on PowerMock.
PowerMock appears to be abandoned and Mockito v4 adds support for static method mocking and constructor mocking which we previously needed to use PowerMock to get. We currently add mockito-core and mockito-inline to lib.(However, Mockito-inline may be abolished when the inline mock-making feature is integrated into the default mock maker in the future. Eventually, it will be mockito-core only. )
Previously we use portal-test/StatementWrapper.java to inspect Target from the statement. After migrating to the new MockitoJUnitRunner, the statement will return as a lambda which will cause the StatementWrapper can not to obtain the statement and then throw an unknown statement exception. So we avoid using MockitoJUnitRunner to init annotation.
We will add the SF rule about this.
Junit Version caused "xxx method .... must return an Iterable of arrays." exception in parametrized tests
See test result in https://github.com/liferay-core-infra/liferay-portal/pull/871
Previously Gradle will load Junit-4.12 when compiling powermock-module-junit4, After we removed powermock dependencies, it uses version Junit-4.11 automatically.
For parametrized tests, JUnit 4.11 expects every parameter set to be an array, so it will throw the exception in our tests. Junit 4.12+ does not has this restriction anymore. so Junit 4.12 is manually added back to the test classpath in LiferayOSGiDefaultsPlugin.java for master.