use of com.vodafone360.people.tests.testutils.TestStatus in project 360-Engine-for-Android by 360.
the class AuthenticatorTest method testGetAccountRemovalAllowed.
/***
* Test the getAccountRemovalAllowed() method.
*/
@SmallTest
@Suppress
public final void testGetAccountRemovalAllowed() {
final TestStatus testStatus = new TestStatus();
Authenticator authenticator = new Authenticator(getContext(), new MainApplication() {
public void removeUserData() {
/*
* Test that the dummy mWakeListener.notifyOfWakeupAlarm() has
* been called, otherwise the test must fail.
*/
testStatus.setPass(true);
}
});
Bundle bundle = null;
try {
bundle = authenticator.getAccountRemovalAllowed(null, null);
} catch (NetworkErrorException e) {
fail("Unexpected NetworkErrorException");
}
/** Test if removeUserData() was called. **/
assertTrue("Expecting the removeUserData() dummy method to have " + "been called", testStatus.isPass());
assertEquals("Expected a KEY_BOOLEAN_RESULT boolean", true, bundle.getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
}
use of com.vodafone360.people.tests.testutils.TestStatus in project 360-Engine-for-Android by 360.
the class RemoteServiceTest method testStartAlarmHbThread.
/**
* Test starting the service with the ALARM_HB_THREAD Intent.
*
* @throws Exception Issue setting up the service.
*/
@MediumTest
public final void testStartAlarmHbThread() throws Exception {
/** Setup test preconditions (i.e. WorkerThread not running). **/
final TestStatus testStatus = new TestStatus();
setupService();
RemoteService remoteService = getService();
remoteService.registerCpuWakeupListener(new IWakeupListener() {
@Override
public void notifyOfWakeupAlarm() {
/*
* Test that the dummy mWakeListener.notifyOfWakeupAlarm() has
* been called, otherwise the test must fail.
*/
testStatus.setPass(true);
}
});
/** Perform test (i.e. trigger ALARM_HB_THREAD). **/
Intent alarmWorkerThreadIntent = new Intent(getContext(), RemoteService.class);
alarmWorkerThreadIntent.putExtra(RemoteService.ALARM_KEY, IWakeupListener.ALARM_HB_THREAD);
startService(alarmWorkerThreadIntent);
/** Test if notifyOfWakeupAlarm() was called. **/
assertTrue("Expecting the notifyOfWakeupAlarm() dummy method to have " + "been called", testStatus.isPass());
}
Aggregations