Example usage for junit.framework Assert assertNull

List of usage examples for junit.framework Assert assertNull

Introduction

In this page you can find the example usage for junit.framework Assert assertNull.

Prototype

static public void assertNull(Object object) 

Source Link

Document

Asserts that an object is null.

Usage

From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java

@Test
public void testGetAssignedRequestByIdentifierShouldNotReturnOpenRequestWhenReferencedByPatientIdentifier() {

    // all these are from the standard test dataset
    Patient patient = patientService.getPatient(2);
    Location medicalRecordLocation = locationService.getLocation(1);
    Location requestLocation = locationService.getLocation(3);

    paperRecordService.requestPaperRecord(patient, medicalRecordLocation, requestLocation);

    PaperRecordRequest request = paperRecordService.getAssignedPaperRecordRequestByIdentifier("101-6",
            medicalRecordLocation);// w w  w . j  a  v a 2  s  . c  o m
    Assert.assertNull(request);
}

From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java

@Test
public void testGetAssignedRequestByIdentifierShouldReturnNullIfNoActiveRequests() {

    Location medicalRecordLocation = locationService.getLocation(1);

    // there is a paper record request in the sample database with this identifier, but it is marked as SENT
    Assert.assertNull(
            paperRecordService.getAssignedPaperRecordRequestByIdentifier("CATBALL", medicalRecordLocation));
}

From source file:com.test.onesignal.MainOneSignalClassRunner.java

@Test
public void testDeleteTagsAfterSync() throws Exception {
    OneSignalInit();//  w  w w.j  av  a  2  s . c o m
    OneSignal.sendTags("{\"foo\": \"bar\", \"fuz\": \"baz\"}");
    threadAndTaskWait();
    Assert.assertEquals("bar", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("foo"));
    Assert.assertEquals("baz", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("fuz"));

    OneSignal.deleteTags("[\"foo\", \"fuz\"]");
    threadAndTaskWait();
    Assert.assertEquals("", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("foo"));
    Assert.assertEquals("", ShadowOneSignalRestClient.lastPost.getJSONObject("tags").get("fuz"));

    GetTags();

    Assert.assertNull(lastGetTags);

    final SharedPreferences prefs = blankActivity.getSharedPreferences(OneSignal.class.getSimpleName(),
            Context.MODE_PRIVATE);
    JSONObject syncValues = new JSONObject(
            prefs.getString("ONESIGNAL_USERSTATE_SYNCVALYES_CURRENT_STATE", null));
    Assert.assertFalse(syncValues.has("tags"));
}

From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java

/**
 * CMS-3031//from   w w  w  . j  av  a2s  . co m
 */
@Test
public void testQueryExplanation_notControll() {
    String query = SERVICE_INSTANCE;
    QueryContext qc = newQueryContext(RAPTOR_REPO, IBranch.DEFAULT_BRANCH);
    qc.setPaginationMode(PaginationMode.ID_BASED);
    qc.setAllowFullTableScan(true);
    qc.setExplain(false);
    IQueryResult queryResult = queryService.query(query, qc);
    Assert.assertNull(queryResult.getExplanations());
}

From source file:com.test.onesignal.MainOneSignalClassRunner.java

@Test
public void testGetTagsWithNoTagsShouldBeNull() throws Exception {
    OneSignalInit();
    GetTags();

    Assert.assertNull(lastGetTags);
}

From source file:com.microsoft.windowsazure.mobileservices.sdk.testapp.test.EnhancedPushTests.java

public void testReRegisterFailTemplate() throws Throwable {
    try {//  w  w w. j  a  v  a 2  s. c o  m

        Context context = getInstrumentation().getTargetContext();
        final SharedPreferences sharedPreferences = PreferenceManager
                .getDefaultSharedPreferences(context.getApplicationContext());

        final Container container = new Container();
        final String handle = "handle";
        final String templateName = "templateName";

        String registrationId1 = "registrationId1";
        String registrationId2 = "registrationId2";

        MobileServiceClient client = new MobileServiceClient(appUrl, appKey, context);

        MobileServiceClient registrationclient = client.withFilter(getUpsertTestFilter(registrationId1));
        MobileServiceClient reRegistrationclient = client.withFilter(getUpsertFailTestFilter(registrationId2));

        final MobileServicePush registrationPush = registrationclient.getPush();
        final MobileServicePush reRegistrationPush = reRegistrationclient.getPush();

        forceRefreshSync(registrationPush, handle);
        forceRefreshSync(reRegistrationPush, handle);

        try {
            registrationPush.registerTemplate(handle, templateName, "{ }", new String[] { "tag1" }).get();
        } catch (Exception exception) {
            fail(exception.getMessage());
        }

        try {
            reRegistrationPush.registerTemplate(handle, templateName, "{ }", new String[] { "tag1" }).get();
        } catch (Exception exception) {
            if (exception instanceof ExecutionException) {
                container.exception = (Exception) exception.getCause();
            } else {
                container.exception = exception;
            }

            container.storedRegistrationId = sharedPreferences
                    .getString(STORAGE_PREFIX + REGISTRATION_NAME_STORAGE_KEY + templateName, null);
        }

        // Asserts
        Exception exception = container.exception;

        if (!(exception instanceof RegistrationGoneException)) {
            fail("Expected Exception RegistrationGoneException");
        }

        Assert.assertNull(container.storedRegistrationId);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java

/**
 * CMS-3031//from www  .ja  v  a 2s  .  co  m
 */
@Test
public void testQueryExplanation_notControll2() {
    String query = "ServiceInstance[@runsOn =& Compute]";
    QueryContext qc = newQueryContext(RAPTOR_REPO, IBranch.DEFAULT_BRANCH);
    qc.setPaginationMode(PaginationMode.ID_BASED);
    qc.setAllowFullTableScan(true);
    qc.setExplain(false);

    IQueryResult queryResult = queryService.query(query, qc);
    Assert.assertNull(queryResult.getExplanations());
}

From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java

@Test
public void testGetSentRequestByIdentifierShouldReturnNullIfNoSentRequests() {

    Location medicalRecordLocation = locationService.getLocation(1);

    Assert.assertNull(
            paperRecordService.getAssignedPaperRecordRequestByIdentifier("101", medicalRecordLocation));
}

From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java

/**
 * limit for embed version//from   www.  j a v  a 2 s . co m
 * 
 * hint for embed
 */
@Test
public void testQueryIterLimit02_embed() {
    String query = "Manifest.versions{*}";
    QueryContext qc = newQueryContext(DEPLOY_REPO, IBranch.DEFAULT_BRANCH);
    qc.setPaginationMode(PaginationMode.ID_BASED);
    qc.setAllowFullTableScan(true);
    qc.getCursor().setLimits(new int[] { 1, 0 });
    int hint = 1;
    qc.getCursor().setHint(hint);
    qc.setSourceIP("127.0.0.1");
    IQueryResult result = queryService.query(query, qc);
    Assert.assertEquals(2, result.getEntities().size());
    Assert.assertFalse(result.hasMoreResults());
    Assert.assertNull(result.getNextCursor());
}

From source file:com.test.onesignal.GenerateNotificationRunner.java

@Test
@Config(shadows = { ShadowGcmBroadcastReceiver.class })
public void shouldPreventOtherGCMReceiversWhenSettingEnabled() throws Exception {
    OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
    OneSignal.startInit(blankActivity).filterOtherGCMReceivers(true).init();
    threadAndTaskWait();/*from  w ww  .  ja  v  a  2  s .c  om*/

    Intent intentGcm = new Intent();
    intentGcm.setAction("com.google.android.c2dm.intent.RECEIVE");
    intentGcm.putExtra("message_type", "gcm");
    Bundle bundle = getBaseNotifBundle();
    bundle.putString("o", "[{\"n\": \"text1\", \"i\": \"id1\"}]");
    intentGcm.putExtras(bundle);

    GcmBroadcastReceiver gcmBroadcastReceiver = new GcmBroadcastReceiver();
    gcmBroadcastReceiver.onReceive(blankActivity, intentGcm);

    Assert.assertNull(ShadowGcmBroadcastReceiver.lastResultCode);
    Assert.assertTrue(ShadowGcmBroadcastReceiver.calledAbortBroadcast);
}