FlexUnit4: [Test(expect="Error")] doesn't catch errors? - apache-flex

The following code produces a failed test, not a passing test (as I would expect):
[Test(expects="Error")]
public function someTest():void {
throw Error("this test doesn't pass");
}

In older versions it was [Test(expected='')]
In newer versions we support both expected and expects as this was confusing for many

Make sure you're linking against the release SWC of FlexUnit, or if you're compiling it yourself, make sure you're using --keep-as3-metadata+=Test in the "additional compiler options" box in project properties.

I think the problem may have been that I was using an older version of FlexUnit4. I just upgraded (to 4.0 RC1) and it seems to be working now.

Related

MSBuild ignores AndroidVersionCode

As the doc stands, one can define -p:AndroidVersionCode=101 as one of MSBuild arguments.
However, the Android Version Code is ignored and the final APK file always contains only the value from AndroidManifest.xml even though the <GenerateApplicationManifest>true</GenerateApplicationManifest> is defined in the *Droid.csproj file (in fact, I've set it also in netstandard csfile).
How to define Version Code for MSBuild?
Here is the complete MSBuild command which I use:
msbuild -t:Clean -t:PackageForAndroid -p:AndroidPackageFormat=apk -p:ApplicationVersion="1.0" -p:AndroidVersionCode=101 -p:ApplicationId="cz.sebastian.myapp" -p:OutputPath="C:\Packages\" -p:Configuration=Release .\MyApp.Droid.csproj
After several practical experiments I've found the following:
Docs are wrong. The property AndroidVersionCode doesn't reflect Android's Version Code, in fact, I didn't find what it's really used for. Version Code can be modified via the ApplicationVersion property, only.
To really change the Version Code one must remove the android:versionCode from AndroidManifest.xml.
To sum up: Remove android:versionCode from Android manifest and use ApplicationVersion with an integer value.
MSBuild version 17.4.0+18d5aef85 for .NET Framework

Failed to resolve: 'com.squareup.retrofit2.converter-gson:2.3.0'

I am trying to include 'com.squareup.retrofit2.converter-gson:2.3.0' using Android Studio 3.2 Canary 5
See image below
as you can search in google, putting this worked, I hope it helps you too
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.4'
Solution
implementation 'com.squareup.retrofit2:converter-gson:<latest-version>'
The latest version can be found here.
Simply paste this instead :
implementation 'com.google.code.gson:gson:2.8.5'
implementation'com.squareup.retrofit2:retrofit:2.6.1'
Use (where is possible) the latest version, I had the same error but it looks like the retrofit 'com.squareup.retrofit2.converter-gson:2.3.0' version 2.3.0 is deprecated.
This works for me:
//Retrofit2
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
Source:
https://square.github.io/retrofit/
https://github.com/square/retrofit
it works perfectly well.
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
It gives/provides the latest repo you'll need.

What to replace for this using Microsoft.WindowsAzure.MobileServices.SQLiteStore.SQLiteStore

We follow this article and it's been running ok https://developer.xamarin.com/samples/xamarin-forms/WebServices%5CTodoAzure/
but then since yesterday we change the code to allow offline sync - #define OFFLINE_SYNC_ENABLED and after that we can't rebuild the solution due to "using Microsoft.WindowsAzure.MobileServices.SQLiteStore;" below missing assembly ? Now check this on Nuget and apparentlt it's beeing deprecated. So what to change on this then?
#if OFFLINE_SYNC_ENABLED
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;
using Microsoft.WindowsAzure.MobileServices.Sync;
#endif
I'm appreciated your input.
Thanks
My bad. Didn't realise that we need to include package for Microsoft.Azure.Mobile.Client.SQLiteStore package from Nuget ...looks good now :)

RobolectricGradleTestRunner vs RobolectricTestRunner.class

In roboelectric when you write your test class you have declare the #RunWith annotation of which there is RobolectricGradleTestRunner and RobolectricTestRunner.class. What is the difference and which one should we use ? Why is there 2 in the first place. If I use RobolectricTestRunner then it does not work for me it says some weird error like :
"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."
However this seems to go away if I use RobolectricGradleTestRunner.
RobolectricTestRunner was first and is for maven based projects.
RobolectricGradleTestRunner was for gradle based projects because some paths have changed.
Since robolectric 3.1.1 this is not more necessary and is now deprecated.
For more details see also http://robolectric.org/getting-started/

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

Resources