org.powermock.api.mockito.ClassNotPreparedException at PowerMockito.mockStatic() when upgrading jdk8 to JDK11 - powermockito

I am using PowerMockito.mockStatic(LogServiceImpl) in my unit test code written in SPOCK framework. Even i declared #PrepareForTest([LogServiceImpl]) at class level, i am getting org.powermock.api.mockito.ClassNotPreparedException.
Earlier it was working fine in JDK8, But when i am upgrading to open jdk 11 facing this issue.
This is the powermock version used in build.gradle file
testCompile 'org.powermock:powermock-module-junit4-rule-agent:2.0.5'
testCompile 'org.powermock:powermock-api-mockito2:2.0.5'
I tried the steps given in
https://github.com/powermock/powermock/issues/933
https://github.com/powermock/powermock/issues/901
Still could not resolve it.. Please help me

Related

error building spring webserver from corda samples

I am trying to run this spring webserver project locally as per https://github.com/corda/samples/tree/release-V4/spring-webserver using command "gradlew.bat runPartyAServer" and getting the following error "2019-08-14 18:08:20,522 main ERROR Rewrite contains an invalid element or attribute "ErrorCodeRewritePolicy"
", can you please help me fix it? PS: The corda-example nodes are already started and running. (edited)
I have already built the corda examples and they are running but spring webserver is not running but producing error
The reason for the error could be the different versions of dependencies.
You can clear the cache and do clean deploy of nodes and run them.
Once the nodes have started, start runPartyAServer again.
The exception
"ERROR Rewrite contains an invalid element or attribute "ErrorCodeRewritePolicy"" is related to version of log4j2.xml.
Most likely, the ErrorCodeRewritePolicy attribute is not present in the version of log4j2.xml file downloaded by the application.
Following is the structure of code containing ErrorCodeRewritePolicy in a log4j2.xml (see https://github.com/corda/corda/blob/master/config/dev/log4j2.xml)-
<Appenders>.....
<Rewrite name="Console-ErrorCode-Selector">
<AppenderRef ref="Console-Selector"/>
<ErrorCodeRewritePolicy/>
</Rewrite>
<Rewrite name="Console-ErrorCode-Appender-Println">
<AppenderRef ref="Console-Appender-Println"/>
<ErrorCodeRewritePolicy/>
</Rewrite>.....
Try replacing $log4j_version by "2.7" in the build.gradle.
Delete the cache and build folders and allow the gradle to download dependencies again.
Replace -
compile "org.apache.logging.log4j:log4j-web:$log4j_version"
By -
compile "org.apache.logging.log4j:log4j-web:2.7"
After alot of debugging, tracing in to the internals of Spring, I think there is a bug in the gradle.build file. I commented out these from the dependencies section:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "junit:junit:$junit_version"
// Corda dependencies.
compile "$corda_release_group:corda-core:$corda_release_version"
compile "$corda_release_group:corda-rpc:$corda_release_version"
compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") // {
// exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
// }
// compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
// compile "org.apache.logging.log4j:log4j-web:$log4j_version"
runtime "$corda_release_group:corda:$corda_release_version"
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.3.61'
}
Now my code runs without the annoying ErrorCodeRewritePolicy error messages, AND I can configure the log levels from applications.properties.

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes)

I have upgraded gms:play-services-analytics from 11.0.4 to 16.0.4
and firebase-messaging from 11.0.4 to 17.1.0 but lint is giving this error
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 16.2.0, 16.0.4, 16.0.3, 16.0.1, 16.0.0. Examples include `com.google.firebase:firebase-messaging:17.1.0` and `com.google.firebase:firebase-iid:16.2.0`
I gave a look into the External libraries i can see different versions of gms is being used here.
com.google.android.gms:play-services-ads-identifier-16.0.0
com.google.android.gms:play-services-analytics-16.0.4
com.google.android.gms:play-services-analytics-impl-16.0.4
com.google.android.gms:play-services-base-16.0.1
com.google.android.gms:play-services-basement-16.0.1
com.google.android.gms:play-services-measurement-base-16.0.3
Similary
com.google.firebase:firebase-common-16.0.0
com.google.firebase:firebase-iid-16.2.0
com.google.firebase:firebase-iid-interop-16.0.0
com.google.firebase:firebase-messaging-17.1.0
i have only added the following two dependencies
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
root level build.gradle contains
classpath 'com.google.gms:google-services:4.0.1'
As mentioned in the blog
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
All firebase/gms libraries can now have a different versioning and the libraries mentioned above are imported by android itself.
Why i am getting this error ?
For me, it was using a rather old build tools version. Updating to build tools 28.0.3 fixed the problem.

Kotlin 1.2.50 and databinding issue

Today I just updated my project to use kotlin 1.2.50 and after when I started compilation i just get an errors :
\app\build\intermediates\feature_data_binding_base_feature_info\demoDebug\dataBindingExportFeaturePackageIdsDemoDebug\out' specified for property 'annotationProcessorOptionProviders$kotlin_gradle_plugin.$0.$0.baseFeatureInfoDir' does not exist.
\app\build\intermediates\feature_data_binding_base_feature_info\demoDebug\dataBindingExportFeaturePackageIdsDemoDebug\out' specified for property 'databinding.baseFeatureInfoDir' does not exist.
On version 1.2.41 compile well.
Does anyone know what is the issue in this case?
Today update for Android Studio solve the issue.
classpath 'com.android.tools.build:gradle:3.2.0-beta01'
-> classpath 'com.android.tools.build:gradle:3.2.0-beta02'

Flex4.6 : works in debug but not in Release build

My flex4.6 works normally in debug.
But when I create a release version, I got:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.adobe.serializers.utility::TypeUtility$/getArrayType()
at com.adobe.serializers.json::JSONDecoder/parseObject()
at com.adobe.serializers.json::JSONDecoder/parseValue()
at com.adobe.serializers.json::JSONDecoder/decode()
at com.bravolucy.football.utilities::Utilities$/getAsObj()
looks like:
http://forums.adobe.com/message/4250338
Original project was done in flex4.0 and it uses some swc libraries.
The answer of your question is in your question itself
"Original project was done in flex4.0 and it uses some swc libraries"
before this para it was said
flex4.6 works normally in debug
It should be working fine with 4.6 because with this version playerglobal.version 11.1 being used normally which has JSON lib included with it but prior version to playerglobal - 11 you need to include "as3corelib.swc" in your project libs.
More details you can find at - http://blog.infrared5.com/2011/07/working-with-native-json-in-flash-player-11/
Thanks,
Varun
You need to add and tick as3corelib.swc in project properties.
But even better would be to switch to native JSON.parse

Automation_agent and qtp_air resource bundles not found when adding automation libs to AIR project

I'm trying to add the automation libraries to my project in Flash Builder so we can automate our testing.
I've added this to the additional compiler settings:
-include-libraries+="${flexlib}/libs/automation/automation.swc","${flexlib}/libs/automation/automation_agent.swc","${flexlib}/libs/automatio n/automation_dmv.swc","${flexlib}/libs/automation/automation_spark.swc ","${flexlib}/libs/automation/automation_air.swc","${flexlib}/libs/aut omation/automation_airspark.swc","${flexlib}/libs/automation/qtp_air.swc"
and -locale nl_BE fr_BE
After compiling this I get 2 errors:
Unable to resolve resource bundle "automation_agent"
Unable to resolve resource bundle "qtp_air"
However, in my nl_BE and fr_BE folders under flex_sdk\frameworks\locale\ the automation_agent_rb.swc and qtp_air_rb.swc are present.
If I switch to en_US, it works fine.
Can somebody explain to me why Flash Builder can't find these resource bundles?
Try explicitly adding automation_agent_rb.swc and qtp_air_rb.swc to your library-path as well.

Resources