Example usage for junit.framework Assert assertNotNull

List of usage examples for junit.framework Assert assertNotNull

Introduction

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

Prototype

static public void assertNotNull(Object object) 

Source Link

Document

Asserts that an object isn't null.

Usage

From source file:org.jasig.schedassist.impl.oraclecalendar.OracleGUIDSourceImplTest.java

@Test
public void testKnownResource() throws Exception {
    OracleCalendarResourceAccount resource = new OracleCalendarResourceAccount();
    resource.setCtcalxitemid("20000:01516");
    resource.setResourceName("DOIT blair test");
    String guid = this.oracleGUIDSource.getOracleGUID(resource);
    Assert.assertNotNull(guid);
    Assert.assertEquals("200000151619869596736320", guid);
}

From source file:ejportal.webapp.action.InstitutionActionTest.java

/**
 * Test edit./*from   www .j  a va 2  s .  c  o m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testEdit() throws Exception {
    this.log.debug("testing edit...");
    this.action.setId(1L);
    Assert.assertNull(this.action.getInstitution());
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getInstitutionBaseTO());
    Assert.assertFalse(this.action.hasActionErrors());
}

From source file:org.atemsource.atem.impl.common.attribute.ListAssociationAttributeTest.java

@Test
public void testSetter() {
    EntityA entity = new EntityA();
    final ArrayList<EntityB> list = new ArrayList<EntityB>();
    list.add(createEntity("Hallo", 2));
    list.add(createEntity("tst", 3));

    ListAssociationAttribute<?> attribute = (ListAssociationAttribute<?>) getAttribute(PROPERTY);
    Assert.assertNotNull(attribute);
    attribute.setValue(entity, list);//from   w  ww . ja  v  a 2s .  co m
    List<EntityB> value = entity.getList();
    assertEquals(list, value);
    Assert.assertTrue(list == value);
}

From source file:com.liferay.mobile.push.DeviceRegistrationTest.java

@Test
public void registerWithSenderId() throws Exception {
    GoogleServices googleServices = Mockito.mock(GoogleServices.class);
    Context context = Robolectric.application;
    String senderId = "senderId";

    final String registrationId = "123";

    Mockito.when(googleServices.getRegistrationId(context, senderId)).thenReturn(registrationId);

    push.setGoogleServices(googleServices);

    push.onSuccess(new Push.OnSuccess() {

        @Override/*from  w  w  w . j  a va2 s. c  o m*/
        public void onSuccess(JSONObject device) {
            try {
                Assert.assertNotNull(device);
                Assert.assertEquals(Push.ANDROID, device.getString("platform"));
                Assert.assertEquals(registrationId, device.getString("token"));
            } catch (JSONException je) {
                Assert.fail();
            }
        }

    }).register(context, senderId);

    Robolectric.runBackgroundTasks();
}

From source file:com.cloudant.sync.datastore.BasicDBBodyTest.java

@Test
public void constructor_emptyMap_objectWithEmptyJsonShouldBeCreated() {
    DocumentBody body = new BasicDocumentBody(new HashMap());
    Assert.assertTrue(Arrays.equals("{}".getBytes(), body.asBytes()));
    Assert.assertNotNull(body.asMap());
    Assert.assertTrue(body.asMap().size() == 0);
}

From source file:ejportal.webapp.action.JournalkostenActionTest.java

/**
 * Test edit./*from   w w  w.  j a  va2s  .  c o  m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testEdit() throws Exception {
    this.log.debug("testing edit...");
    this.action.setJournalkostenId(1L);
    this.action.setJournalId(1L);
    Assert.assertNull(this.action.getJournalkosten());
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getJournalkosten());
    Assert.assertFalse(this.action.hasActionErrors());
}

From source file:org.openmrs.logic.LogicServiceTest.java

/**
 * TODO make this test use assert statements instead of printing to stdout
 *///from   w  w w.  j  av  a 2s.c o  m
@Test
public void shouldObservationRule() {
    LogicService logicService = Context.getLogicService();
    Cohort patients = new Cohort();
    Map<Integer, Result> result = null;

    patients.addMember(2);

    try {
        Result r = logicService.eval(2, new LogicCriteriaImpl("CD4 COUNT"));
        Assert.assertNotNull(r);
        Assert.assertEquals(0, r.size());

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT"));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").lt(170));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").gt(185));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").equalTo(190));
        Assert.assertNotNull(result);

        Calendar cal = Calendar.getInstance();
        cal.set(2006, 3, 11);
        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").before(cal.getTime()));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").lt(190).before(cal.getTime()));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").after(cal.getTime()));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").last());
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").last().before(cal.getTime()));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").not().lt(150));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").not().not().lt(150));
        Assert.assertNotNull(result);

        patients.addMember(2);
        patients.addMember(3);
        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").lt(200));
        Assert.assertNotNull(result);

        patients.addMember(39);
        result = logicService.eval(patients,
                new LogicCriteriaImpl("PROBLEM ADDED").contains("HUMAN IMMUNODEFICIENCY VIRUS"));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT"));
        Assert.assertNotNull(result);

        result = logicService.eval(patients, new LogicCriteriaImpl("CD4 COUNT").within(Duration.months(1)));
        Assert.assertNotNull(result);

    } catch (LogicException e) {
        log.error("testObservationRule: Error generated", e);
    }
}

From source file:org.openxdata.server.service.impl.SettingServiceTest.java

@Test
public void saveSettingGroup_shouldSaveSettingGroup() throws Exception {
    Assert.assertNull(getSettingGroup("Name"));

    settingService.saveSettingGroup(new SettingGroup("Name"));

    Assert.assertNotNull(getSettingGroup("Name"));
}

From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java

@Test
public void verifyCredentialsTest() {
    final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open");
    final InstaRecordBean instaRecordBean = client.verifyCredentials();
    //[{"type":"user","user_id":1615568,"username":"jinstapaper@gmail.com","subscription_is_active":"1"}]
    Assert.assertNotNull(instaRecordBean);
    Assert.assertEquals("user", instaRecordBean.type);
    Assert.assertEquals(Boolean.TRUE, instaRecordBean.subscription_is_active);
    Assert.assertEquals("1615568", instaRecordBean.user_id);
    Assert.assertEquals("jinstapaper@gmail.com", instaRecordBean.username);
}

From source file:com.liferay.mobile.push.ReceivePushNotificationTest.java

@Test
public void isReceiverRegistered() throws Exception {
    ShadowApplication app = Robolectric.getShadowApplication();

    List<Wrapper> wrappers = app.getRegisteredReceivers();

    Assert.assertFalse(wrappers.isEmpty());

    BroadcastReceiver receiver = null;//from   ww  w  .  j  a v a 2  s. co m

    for (Wrapper wrapper : wrappers) {
        if (wrapper.broadcastReceiver instanceof PushNotificationsReceiver) {

            receiver = wrapper.broadcastReceiver;
        }
    }

    Assert.assertNotNull(receiver);
}