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

Source Link

Document

Asserts that an object is null.

Usage

From source file:com.workday.autoparse.json.demo.JsonTestUtils.java

static void assertJSONObjectsEqual(String message, JSONObject expected, Object actual) {
    if (expected == null) {
        Assert.assertNull(message + " is null", actual);
        return;//w  w  w  .  j a va 2  s  . com
    }

    Assert.assertNotNull(message + " not null", actual);
    Assert.assertTrue(message + " expected JSONObject but found " + actual.getClass().getCanonicalName(),
            actual instanceof JSONObject);

    JSONObject actualJsonObject = (JSONObject) actual;
    Assert.assertEquals(message + ": size", expected.length(), actualJsonObject.length());

    @SuppressWarnings("unchecked")
    Iterator<String> keys = expected.keys();
    while (keys.hasNext()) {
        String key = keys.next();
        Assert.assertEquals(message + ": " + key, expected.opt(key), actualJsonObject.opt(key));
    }
}

From source file:Project4Test.java

@Test
public void nullTest() {
    Assert.assertNull("Object is not null", serivceTwo);

}

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

@Test
public void getSetting_shouldReturnNullIfNoFormDataFoundWithGivenId() throws Exception {
    Assert.assertNull("formData with id=-1 exists", studyManagerService.getFormData(-1));
}

From source file:com.ignou.aadhar.util.BankAccountCreatorTest.java

@Test
public void testInvalidCreateAccount() {

    JsonWrapper output = creatorObj.createAccount("1234567890abcdefghijkl");
    Assert.assertEquals("Failure response not returned.", "FAILURE", output.get("status"));
    Assert.assertNull("Account ID returned for invalid UID", output.get("id"));
}

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

@Test
public void deleteFormData_shouldDeleteFormDataWithGivenId() throws Exception {
    final int formDataId = 1;

    Assert.assertNotNull("form data does not exist", studyManagerService.getFormData(formDataId));
    studyManagerService.deleteFormData(formDataId);
    Assert.assertNull("formData still exists", studyManagerService.getFormData(formDataId));
}

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

@Test
public void priorityEvictionByFIFOTest() throws Exception {
    logger.info("write low priority object");
    gigaSpace.write(new BronzeMedal(0));
    logger.info("fill cache exactly with hight priority object");
    for (int i = 1; i < cacheSize; i++) {
        gigaSpace.write(new GoldMedal(i));
    }//  w  ww  .ja  v a2 s .c o  m
    logger.info("write another lower priority object");
    gigaSpace.write(new BronzeMedal(1));
    logger.info("assert the first object was removed");
    Assert.assertNull("BronzeMedal 0 was not evicted", gigaSpace.read(new BronzeMedal(0)));
    logger.info("Test Passed");
}

From source file:cz.fi.muni.pa165.dao.PlayerDaoImplTest.java

@Test
public void testDelete() {
    System.out.println("testDelete started");
    Player p1 = new Player();

    p1.setName("Ronaldo");
    p1.setPosition(Position.FORWARD);
    p1.setDateOfBirth(new Date(System.currentTimeMillis()));
    p1.setDressNumber(7);// w  w w . ja v  a2s  . c  o  m
    p1.setCountry("Portugal");

    playerDao.create(p1);

    long id = p1.getId();
    Assert.assertNotNull("Player was not created!!", playerDao.findById(id));
    playerDao.delete(p1);
    Assert.assertNull("Player was not deleted", playerDao.findById(id));
}

From source file:pandora.redis.dao.RedisUserDaoTest.java

@Test
public void user() {
    try {/*from  ww w. j  a  v  a2 s .  c o  m*/
        User user = new User();

        int id = 1000000001;
        String name = "name";

        user.setId(id);
        user.setName(name);

        /*
         * set
         */
        userDao.setUser(user);
        User user4redis = userDao.getUser(user);

        Assert.assertEquals("set id", user.getId(), user4redis.getId());
        Assert.assertEquals("set name", user.getName(), user4redis.getName());

        /*
         * chg
         */
        user.setName("name-chg");
        userDao.chgUser(user);

        user4redis = userDao.getUser(user);

        Assert.assertEquals("chg id", user.getId(), user4redis.getId());
        Assert.assertEquals("chg name", user.getName(), user4redis.getName());

        /*
         * del
         */
        userDao.delUser(user);
        user4redis = userDao.getUser(user);

        Assert.assertNull("del", user4redis);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.sf.dynamicreports.test.jasper.AbstractJasperChartTest.java

protected void chartTitleTest(String name, int index, String title) {
    TextTitle chartTitle = getChart(name, index).getTitle();
    if (title != null) {
        Assert.assertEquals("chart title", title, chartTitle.getText());
    } else {/*from  w w w .  j a  v a2s . c o  m*/
        Assert.assertNull("chart title", chartTitle);
    }
}

From source file:net.sf.dynamicreports.test.jasper.chart.PieChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*www  .j  a  va 2 s .c o  m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    Plot plot = chart.getPlot();
    Assert.assertEquals("plot", PiePlot.class, plot.getClass());
    Assert.assertFalse("circular", ((PiePlot) plot).isCircular());
    Assert.assertEquals("label format", "label {0}",
            ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLabelGenerator()).getLabelFormat());
    Assert.assertEquals("legend label format", "legend label {0}",
            ((StandardPieSectionLabelGenerator) ((PiePlot) plot).getLegendLabelGenerator()).getLabelFormat());

    chart = getChart("summary.chart2", 0);
    plot = chart.getPlot();
    Assert.assertNull("label format", ((PiePlot) plot).getLabelGenerator());
}