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.openscore.lang.runtime.navigations.NavigationsTest.java

@Test
public void errorNavigationTest() throws Exception {

    RunEnvironment runEnv = new RunEnvironment();
    Long nextStepId = 2L;//  w  w w  .  j a  v a 2  s .c o  m
    runEnv.putNextStepPosition(nextStepId);
    ExecutionRuntimeServices runtimeServices = new ExecutionRuntimeServices();
    runtimeServices.setStepErrorKey("Error");
    Long nextPosition = navigations.navigate(runEnv, runtimeServices);

    Collection<ScoreEvent> events = runtimeServices.getEvents();

    Assert.assertNull(nextPosition);

    Assert.assertFalse(events.isEmpty());
    ScoreEvent stepErrorEvent = null;
    for (ScoreEvent event : events) {
        if (event.getEventType().equals(SLANG_EXECUTION_EXCEPTION)) {
            stepErrorEvent = event;
        }
    }
    Assert.assertNotNull(stepErrorEvent);
}

From source file:com.cemeterylistingswebtest.test.domain.SubscriberTest.java

@Test(dependsOnMethods = "create")
public void readNotNull() {
    repo = ctx.getBean(SubscriberRepository.class);
    Assert.assertNotNull(repo.findOne(id).getSubscriberID());

}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.ObsControllerTest.java

/**
 * @see ObsController#getObs(String,WebRequest)
 * @verifies get a default representation of a obs
 *//*  w  w  w  .j av a2  s.  co m*/

@Test
public void getObs_shouldGetADefaultRepresentationOfAObs() throws Exception {
    Object result = new ObsController().retrieve("39fb7f47-e80a-4056-9285-bd798be13c63", emptyRequest());
    Assert.assertNotNull(result);
    Util.log("Obs fetched (default)", result);
    Assert.assertEquals("39fb7f47-e80a-4056-9285-bd798be13c63", PropertyUtils.getProperty(result, "uuid"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "links"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "person"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "concept"));
}

From source file:org.web4thejob.orm.DataReaderServiceTest.java

@Test
public void queryWithLocalCriteria() {
    final Reference1 reference1 = ContextUtil.getDRS().getOne(Reference1.class);
    Assert.assertNotNull(reference1);

    final Query query = ContextUtil.getEntityFactory().buildQuery(Master1.class);
    query.addCriterion(new Path(Master1.FLD_REFERENCE1), Condition.EQ, reference1);
    query.addCriterion(new Path(Master1.FLD_NAME), Condition.EQ, Master1.class.getName());
    Assert.assertEquals(2, query.getCriteria().size());
    final Master1 master1 = ContextUtil.getDRS().findFirstByQuery(query);
    Assert.assertNotNull(master1);/*from   w w w.j  a v a  2s. com*/
}

From source file:org.codehaus.grepo.query.jpa.repository.JpaRepositoryTest.java

@Test
public void testWithNamedSQLQueryUsingNamedParams() {
    Assert.assertNotNull(repo.getByUsernameWithNamedNativeQueryUsingNamedParams("username"));
}

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

@Test
public void saveStudy_shouldSaveStudy() throws Exception {
    final String studyName = "StudyName";

    List<StudyDef> studies = studyManagerService.getStudies();
    Assert.assertEquals("There are 4 studies", 4, studies.size());
    Assert.assertNull(getStudy(studyName, studies));

    StudyDef study = new StudyDef();
    study.setName(studyName);/* w w  w . jav  a 2s  . c  o m*/
    study.setCreator(userService.getUsers().get(0));
    study.setDateCreated(new Date());

    studyManagerService.saveStudy(study);

    studies = studyManagerService.getStudies();
    Assert.assertEquals("Added 1 study, now there are 5", 5, studies.size());
    Assert.assertNotNull(getStudy(studyName, studies));
}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.PersonAttributeControllerTest.java

@Test
public void shouldListAttributesForPerson() throws Exception {
    SimpleObject result = controller.getAll(personUuid, request, response);
    Assert.assertNotNull(result);
    Assert.assertEquals(3, Util.getResultsSize(result));
}

From source file:org.openmrs.module.kenyaemr.reporting.builder.indicator.Moh731ReportTest.java

@Test
public void test() throws Exception {
    Program hivProgram = Metadata.getProgram(Metadata.HIV_PROGRAM);

    // Enroll patient #6 in the HIV program
    TestUtils.enrollInProgram(Context.getPatientService().getPatient(6), hivProgram,
            TestUtils.date(2012, 1, 15), null);

    ReportDefinition rd = report.getReportDefinition();

    // Run report on all patients for Jan 2012
    EvaluationContext context = ReportingTestUtils.reportingContext(Arrays.asList(2, 6, 7, 8, 999),
            TestUtils.date(2012, 1, 1), TestUtils.date(2012, 1, 31));

    ReportData data = Context.getService(ReportDefinitionService.class).evaluate(rd, context);

    Assert.assertEquals(1, data.getDataSets().size());
    MapDataSet dataSet = (MapDataSet) data.getDataSets().get("MOH 731 DSD");
    Assert.assertNotNull(dataSet);

    Assert.assertEquals(1, ((IndicatorResult) dataSet.getColumnValue(1, "HV03-09")).getValue().intValue());
    Assert.assertEquals(1, ((IndicatorResult) dataSet.getColumnValue(1, "HV03-13")).getValue().intValue());

    ReportingTestUtils.printReport(data);
}

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

/**
 * Test edit./*from   w w  w . ja  v  a2  s. c o m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testEdit() throws Exception {
    // so request.getRequestURL() doesn't fail
    final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/editUser.html");
    ServletActionContext.setRequest(request);

    this.action.setId("-1"); // regular user
    Assert.assertNull(this.action.getUser());
    Assert.assertEquals("success", this.action.edit());
    Assert.assertNotNull(this.action.getUser());
    Assert.assertFalse(this.action.hasActionErrors());
}

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

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