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.openmrs.module.printer.PrinterServiceComponentTest.java

@Test
public void testSavePrinter() {

    Printer printer = new Printer();
    printer.setName("Another Test Printer");
    printer.setIpAddress("192.1.1.8");
    printer.setType(PrinterType.ID_CARD);

    printerService.savePrinter(printer);

    List<Printer> printers = printerService.getAllPrinters();

    // there is already a test printer in the dataset, so there should be two printers now
    Assert.assertEquals(2, printers.size());

    // make sure the audit fields have been set
    Assert.assertNotNull(printer.getDateCreated());
    Assert.assertNotNull(printer.getCreator());
    Assert.assertNotNull(printer.getUuid());
}

From source file:org.openmrs.module.webservices.rest19ext.web.v1_0.controller.ProviderAttributeControllerTest.java

@Test
public void shouldGetAProviderAttribute() throws Exception {
    Object result = controller.retrieve(Rest19ExtTestConstants.PROVIDER_UUID,
            Rest19ExtTestConstants.PROVIDER_ATTRIBUTE_UUID, request);
    String rfc822Timezone = new SimpleDateFormat("Z").format(new Date());
    Assert.assertNotNull(result);
    Assert.assertEquals(Rest19ExtTestConstants.PROVIDER_ATTRIBUTE_UUID,
            PropertyUtils.getProperty(result, "uuid"));
    Assert.assertEquals("2011-04-25T00:00:00.000" + rfc822Timezone, PropertyUtils.getProperty(result, "value"));
    Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo"));
}

From source file:com.taobao.ad.jpa.test.UUserTest.java

@Test
public void testGetUUserByUsername() {
    UUserDO uUser = userBO.getUUserByUsername("baimei");
    Assert.assertNotNull(uUser);
    Assert.assertEquals("1", uUser.getDescn());
    Assert.assertEquals(1, uUser.getId().longValue());
    Assert.assertEquals("baimei1@taobao.com", uUser.getEmail());
    Assert.assertEquals("136666992031", uUser.getMobile());
    Assert.assertEquals("eabd8ce9404507aa8c22714d3f5eada9", uUser.getPassword());

}

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

@Test
public void testWithNamedSQLQuery() {
    Assert.assertNotNull(repo.getByUsernameWithNamedNativeQuery("username"));
}

From source file:org.openmrs.module.webservices.rest19ext.web.v1_0.controller.LocationAttributeControllerTest.java

@Test
public void shouldGetALocationAttribute() throws Exception {
    Object result = controller.retrieve(Rest19ExtTestConstants.LOCATION_UUID,
            Rest19ExtTestConstants.LOCATION_ATTRIBUTE_UUID, request);
    String rfc822Timezone = new SimpleDateFormat("Z").format(new Date());
    Assert.assertNotNull(result);
    Assert.assertEquals(Rest19ExtTestConstants.LOCATION_ATTRIBUTE_UUID,
            PropertyUtils.getProperty(result, "uuid"));
    Assert.assertEquals("2011-04-25T00:00:00.000" + rfc822Timezone, PropertyUtils.getProperty(result, "value"));
    Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo"));
}

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

@Test
public void saveTask_shouldSaveTask() throws Exception {
    final String taskName = "TaskName";

    TaskDef task = new TaskDef();
    task.setName(taskName);//from  w  w  w  .j  a v  a  2  s .co  m
    task.setCreator(userService.getUsers().get(0));
    task.setDateCreated(new Date());

    tasksService.saveTask(task);

    List<TaskDef> tasks = tasksService.getTasks();
    Assert.assertEquals(4, tasks.size());
    Assert.assertNotNull(tasksService.getTask(taskName));
}

From source file:org.openmrs.module.formfilter.web.controller.ViewFormFilterControllerTest.java

/**
 * @see {@link ViewFormFilterController#viewFormFilter(ModelMap, Integer, Integer)}
 *///from ww w  . j av  a2s  .com
@Test
@Verifies(value = "should return FormFilter by form filter id", method = "viewFormFilter(ModelMap, Integer, Integer)")
public void viewFormFilter_ShouldReturnFormFilterByFormFilterId() {
    ViewFormFilterController controller = new ViewFormFilterController();
    ModelMap model = new ModelMap();
    controller.viewFormFilter(model, null, "1");
    Assert.assertNotNull(((FormFilter) model.get("formfilter")));
}

From source file:fragment.web.StaticPagesControllerTest.java

@Test
public void testfaqs() {
    String faqs = controller.faqs(map);
    Assert.assertNotNull(map.get("tenant"));
    Assert.assertEquals(faqs, new String("main.faqs"));
}

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

@Test
public void saveSetting_shouldSaveSetting() throws Exception {
    Assert.assertNull(settingService.getSetting("Name"));

    settingService.saveSetting(new Setting("Name", "Description", "Value"));

    String setting = settingService.getSetting("Name");
    Assert.assertNotNull(setting);
}

From source file:org.codehaus.grepo.query.hibernate.repository.HibernateRepositoryTest.java

@Test
public void testWithNamedNativeQuery() {
    Assert.assertNotNull(repo.getByUsernameWithNamedNativeQuery("username"));
}