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(String message, Object object) 

Source Link

Document

Asserts that an object isn't null.

Usage

From source file:org.apache.synapse.transport.passthru.config.BaseConfigurationTest.java

@Test
public void testBuild() throws Exception {
    Assert.assertNotNull("Building base configuration isn't successful.", baseConfiguration);
    Assert.assertNotNull("Worker pool hasn't been initialized.", baseConfiguration.getWorkerPool());
    Assert.assertNotSame("Worker thread count hasn't been taken from passthru-http.properties file",
            conf.getWorkerPoolCoreSize(), DEFAULT_WORKER_POOL_SIZE_CORE);

}

From source file:com.krawler.spring.crm.productlib.CrmProductDAOTest.java

/**
 * testing to get all products//from ww  w  .  java2 s .  c  om
 */

@Test
public void testGetAllProducts() {
    HashMap<String, Object> requestParams = new HashMap<String, Object>();
    ArrayList order_by = new ArrayList();
    ArrayList order_type = new ArrayList();
    order_by.add("c.productname");
    order_type.add("asc");
    requestParams.put("order_by", order_by);
    requestParams.put("order_type", order_type);
    requestParams.put("filter_names", new ArrayList());
    requestParams.put("filter_values", new ArrayList());
    try {

        kwlReturnObject = productDAO.getAllProducts(requestParams);
        Assert.assertNotNull("kwlReturnObject must not be null", kwlReturnObject);
        logger.info(kwlReturnObject.getRecordTotalCount());
        Assert.assertNotNull("product list must not be null", kwlReturnObject.getEntityList());
        logger.info(kwlReturnObject.getEntityList().size());
        logger.info(kwlReturnObject.getMsg());
        logger.info(kwlReturnObject.getErrorCode());
        for (CrmProduct crmProduct : (ArrayList<CrmProduct>) kwlReturnObject.getEntityList()) {
            logger.info(crmProduct.getProductid());
        }
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.obiba.onyx.core.service.impl.UpdateParticipantListenerTest.java

@Test
@Dataset//from w ww.  ja  va2 s.c  om
public void testOnParticipantRead() {
    int i = 1;
    for (Participant participant : getParticipants()) {
        // updateParticipantListener.onParticipantRead(i, participant);
        i++;
    }

    Assert.assertEquals(3l, persistenceManager.match(new Participant()).size());

    // test we can run same file multiple times without breaking the db
    i = 1;
    for (Participant participant : getParticipants()) {
        // updateParticipantListener.onParticipantRead(i, participant);
        i++;
    }

    Assert.assertEquals(3l, persistenceManager.match(new Participant()).size());
    Participant p = new Participant();
    p.setEnrollmentId("100001");
    p = persistenceManager.matchOne(p);
    Assert.assertNotNull("Cannot find participant", p);
    Assert.assertNotNull("Cannot find participant appointment", p.getAppointment());
    Assert.assertNotNull("Cannot find participant appointment date", p.getAppointment().getDate());

    // add a completed interview
    p = new Participant();
    p.setEnrollmentId("100003");
    p = persistenceManager.matchOne(p);
    Interview interview = new Interview();
    interview.setStatus(InterviewStatus.COMPLETED);
    interview.setStartDate(new Date());
    interview.setParticipant(p);
    persistenceManager.save(interview);
    p.setInterview(interview);
    persistenceManager.save(p);
    p = new Participant();
    p.setEnrollmentId("100003");
    p = persistenceManager.matchOne(p);
    Assert.assertNotNull("Cannot find participant", p);
    Assert.assertNotNull("Cannot find participant interview", p.getInterview());
    Assert.assertEquals("Cannot find participant completed interview", InterviewStatus.COMPLETED,
            p.getInterview().getStatus());

    i = 1;
    for (Participant participant : getParticipants()) {
        // updateParticipantListener.onParticipantRead(i, participant);
        i++;
    }

    Assert.assertEquals(3l, persistenceManager.match(new Participant()).size());
    p = new Participant();
    p.setEnrollmentId("100003");
    p = persistenceManager.matchOne(p);
    Assert.assertNotNull("Cannot find participant", p);
    Assert.assertNotNull("Cannot find participant appointment", p.getAppointment());
    Assert.assertNotNull("Cannot find participant appointment date", p.getAppointment().getDate());
    Assert.assertNotNull("Cannot find participant interview", p.getInterview());
    Assert.assertEquals("Cannot find participant completed interview", InterviewStatus.COMPLETED,
            p.getInterview().getStatus());

}

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

@Test
public void testFindUserByEmail() throws Exception {
    User user = userService.findUserByEmail("cattabanks@gmail.com");
    Assert.assertNotNull("mark's users is there", user);
    Assert.assertEquals("his username is admin", "admin", user.getName());

}

From source file:com.mnxfst.testing.server.cfg.TestPTestServerConfigurationParser.java

@Test
public void testEvaluateStringWithExpressionNotMatchingDocument()
        throws ParserConfigurationException, XPathExpressionException {
    PTestServerConfigurationParser p = new PTestServerConfigurationParser();
    String result = p.evaluateString(p.xpathExpressionHostname,
            DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
    Assert.assertNotNull("The result must not be null", result);
    Assert.assertTrue("The result must be empty", result.isEmpty());
}

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

@Test
public void testThatServiceIsConfiguredCorrectly() {
    Assert.assertNotNull("Couldn't autowire PaperRecordService", paperRecordService);
    Assert.assertNotNull("Couldn't get PaperRecordService from Context",
            Context.getService(PaperRecordService.class));
}

From source file:org.deviceconnect.android.profile.restful.test.NormalPhoneProfileTestCase.java

/**
 * ??(?)??./*from  ww w .  j  a  va  2 s  . com*/
 * <pre>
 * ?HTTP
 * Method: PUT
 * Path: /phone/set?deviceid=xxxx&mode=0
 * </pre>
 * <pre>
 * ??
 * result?0???????
 * </pre>
 */
public void testPutSet001() {
    StringBuilder builder = new StringBuilder();
    builder.append(DCONNECT_MANAGER_URI);
    builder.append("/" + PhoneProfileConstants.PROFILE_NAME);
    builder.append("/" + PhoneProfileConstants.ATTRIBUTE_SET);
    builder.append("?");
    builder.append(DConnectProfileConstants.PARAM_DEVICE_ID + "=" + getDeviceId());
    builder.append("&");
    builder.append(PhoneProfileConstants.PARAM_MODE + "=0");
    builder.append("&");
    builder.append(AuthorizationProfileConstants.PARAM_ACCESS_TOKEN + "=" + getAccessToken());
    try {
        HttpUriRequest request = new HttpPut(builder.toString());
        JSONObject root = sendRequest(request);
        Assert.assertNotNull("root is null.", root);
        Assert.assertEquals(DConnectMessage.RESULT_OK, root.getInt(DConnectMessage.EXTRA_RESULT));
    } catch (JSONException e) {
        fail("Exception in JSONObject." + e.getMessage());
    }
}

From source file:org.apache.synapse.transport.passthru.config.BaseConfigurationTest.java

@Test
public void testGetWorkerPool() throws Exception {
    Assert.assertNotNull("Worker pool hasn't been initialized.", baseConfiguration.getWorkerPool());
}

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

@Test
public void testGetStudyList_forAdmin() throws Exception {
    User user = userService.findUserByUsername("admin");
    List<Object[]> studies = formDownloadService.getStudyList(user);
    Assert.assertNotNull("There are studies for admin user", studies);
    Assert.assertEquals("There are four studies", 4, studies.size());
    assertStudy(studies.get(0), new Integer(2), "Another Sample Study");
    assertStudy(studies.get(1), new Integer(4), "More Sample Study");
    assertStudy(studies.get(2), new Integer(1), "Sample Study");
    assertStudy(studies.get(3), new Integer(3), "Yet Another Sample Study");
}

From source file:org.openspaces.eviction.test.ClassSpecificOrderTest.java

@Test
public void inClassLRUModifyTest() throws Exception {
    logger.info("same as inClassLRUTest but modify the object instead of read it");

    SilverMedal silverMedal = new SilverMedal(0);
    gigaSpace.write(silverMedal);//from w w  w  . j a v a2 s  . c om
    silverMedal.setContest("Butterfly 100m");
    for (int i = 1; i <= cacheSize + 10; i++) {
        if (i == (cacheSize / 2))
            gigaSpace.write(silverMedal);
        else
            gigaSpace.write(new SilverMedal(i));
    }
    Assert.assertEquals("amount of objects in space is larger than cache size", gigaSpace.count(new Object()),
            cacheSize);
    Assert.assertNotNull("silver medal 0 is not in space", gigaSpace.read(silverMedal));
}