{
UserActivity ua = UserActivityFactory.userActivity();
try
{
GlobalId ac1 = null;
GlobalId ac2 = null;
ua.start();
ac1 = ua.activityId();
System.out.println("Started: "+ac1);
ua.start();
ac2 = ua.activityId();
System.out.println("\nStarted: "+ac2);
ActivityHierarchy ctx = ua.suspend();
System.out.println("\nSuspended: "+ctx);
if (ua.currentActivity() != null) {
fail("Current activity shoudl be null " + ua.currentActivity());
}
ua.resume(ctx);
if (!ac2.equals(ua.activityId()))
{
fail("Current activity id " + ua.activityId() + " should equal " + ac2);
}
ua.end();