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.webservices.rest.web.v1_0.controller.OrderControllerTest.java

@Test
public void shouldGetDrugOrderAsRef() throws Exception {
    request.setParameter(RestConstants.REQUEST_PROPERTY_FOR_REPRESENTATION,
            Representation.REF.getRepresentation());
    Object o = controller.retrieve(DRUG_ORDER_UUID, request);
    Assert.assertEquals(DRUG_ORDER_UUID, PropertyUtils.getProperty(o, "uuid"));
    Assert.assertNotNull(PropertyUtils.getProperty(o, "display"));
    Assert.assertNull(PropertyUtils.getProperty(o, "concept"));
}

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

/**
 * Test execute.//from  w w  w  .  ja  va  2 s  .  c  om
 * 
 * @throws Exception
 *             the exception
 */
public void testExecute() throws Exception {
    final User user = new User();
    user.setUsername("self-registered");
    user.setPassword("Password1");
    user.setConfirmPassword("Password1");
    user.setFirstName("First");
    user.setLastName("Last");

    final Address address = new Address();
    address.setCity("Denver");
    address.setProvince("CO");
    address.setCountry("USA");
    address.setPostalCode("80210");
    user.setAddress(address);

    user.setEmail("self-registered@raibledesigns.com");
    user.setWebsite("http://raibledesigns.com");
    user.setPasswordHint("Password is one with you.");
    this.action.setUser(user);

    // set mock response so setting cookies doesn't fail
    ServletActionContext.setResponse(new MockHttpServletResponse());

    // start SMTP Server
    final Wiser wiser = new Wiser();
    wiser.setPort(this.getSmtpPort());
    wiser.start();

    Assert.assertEquals("success", this.action.save());
    Assert.assertFalse(this.action.hasActionErrors());

    // verify an account information e-mail was sent
    wiser.stop();
    Assert.assertTrue(wiser.getMessages().size() == 1);

    // verify that success messages are in the session
    Assert.assertNotNull(this.action.getSession().getAttribute(Constants.REGISTERED));

    SecurityContextHolder.getContext().setAuthentication(null);
}

From source file:com.nokia.dempsy.router.TestRouterClusterManagement.java

@Test
public void testGetRouterFound() {
    Set<ClusterRouter> routers = routerFactory.getRouter(java.lang.Exception.class);
    Assert.assertNotNull(routers);
    Assert.assertEquals(false, routerFactory.missingMsgTypes.containsKey(java.lang.Exception.class));
    Set<ClusterRouter> routers1 = routerFactory.getRouter(ClassNotFoundException.class);
    Assert.assertEquals(routers, routers1);
}

From source file:de.akquinet.chameria.activation.ActivationTest.java

@Test
public void startChameriaWithActivationAndArguments() throws Exception {

    ChameRIA chameleon = new ChameRIA("target/core", true, null, APP_1_DIRECTORY, null, null);
    Framework framework = chameleon.start(new String[] { "-open", "bla" });

    ServiceReference ref = framework.getBundleContext().getServiceReference(ActivationService.class.getName());
    Assert.assertNotNull(ref);
    ActivationService svc = (ActivationService) framework.getBundleContext().getService(ref);
    count = svc.getClass().getField("activation_count");
    args = svc.getClass().getField("last_args");
    open = svc.getClass().getField("open");

    Assert.assertEquals(1, count.get(svc));
    Assert.assertEquals(2, ((String[]) args.get(svc)).length);
    Assert.assertEquals("bla", open.get(svc));

    chameleon.stop();//  w w  w. ja va2 s .  c o  m
}

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

@Test
public void shouldEditName() throws Exception {
    String json = "{ \"familyName\":\"newName\" }";
    SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class);
    PersonName personName = service.getPersonNameByUuid(nameUuid);
    Assert.assertEquals("User", personName.getFamilyName());
    controller.update(personUuid, nameUuid, post, request, response);
    personName = service.getPersonNameByUuid(nameUuid);
    Assert.assertNotNull(personName);
    Assert.assertEquals("newName", personName.getFamilyName());
}

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

@Test
public void saveReportGroup_shouldSaveReportGroup() throws Exception {
    final String groupName = "New Report Group";

    List<ReportGroup> reportGroups = reportsService.getReportGroups();
    Assert.assertEquals(1, reportGroups.size());
    Assert.assertNull(getReportGroup(groupName, reportGroups));

    ReportGroup reportGroup = new ReportGroup(groupName);
    reportGroup.setCreator(userService.getUsers().get(0));
    reportGroup.setDateCreated(new Date());
    reportsService.saveReportGroup(reportGroup);

    reportGroups = reportsService.getReportGroups();
    Assert.assertEquals(2, reportGroups.size());

    reportGroup = getReportGroup(groupName, reportGroups);
    Assert.assertNotNull(reportGroup);
    Assert.assertEquals(groupName, reportGroup.getName());
}

From source file:org.netxilia.spi.impl.formula.TestCellCommands.java

@Test
public void testPasteFromCell() throws NetxiliaResourceException, NetxiliaBusinessException {
    ISheet sheet = SheetUtils.sheetWithCell();

    String[][] data = { { "=B1 + 10", "100" }, { "true", "=$B$2 + 100" } };
    sheet.sendCommand(cellCommands.paste(new AreaReference("C2:D3"), data, new CellReference("A1")));

    CellData newDataC2 = sheet.receiveCell(new CellReference("C2")).getNonBlocking();
    Assert.assertNotNull(newDataC2);
    Assert.assertEquals(new Formula("=D2 + 10"), newDataC2.getFormula());

    CellData newDataC3 = sheet.receiveCell(new CellReference("C3")).getNonBlocking();
    Assert.assertNotNull(newDataC3);//w ww . j a va  2 s.  c o m
    Assert.assertEquals(true, newDataC3.getValue().getBooleanValue().booleanValue());

    CellData newDataD2 = sheet.receiveCell(new CellReference("D2")).getNonBlocking();
    Assert.assertNotNull(newDataD2);
    Assert.assertEquals(100.0, newDataD2.getValue().getNumberValue());

    CellData newDataD3 = sheet.receiveCell(new CellReference("D3")).getNonBlocking();
    Assert.assertNotNull(newDataD3);
    Assert.assertEquals(new Formula("=$B$2 + 100"), newDataD3.getFormula());
}

From source file:com.nomsic.randb.persistence.xml.RandbXMLPersistenceProviderTest.java

@Test
public void testLoad() throws RandbException, FileNotFoundException, IOException {
    String name = "testName";
    BlockGroup generate = BlockGroup.generate(name, 10, Arrays.asList(new Integer[] { 2, 4, 9 }),
            Arrays.asList(new String[] { "A", "B" }));

    List<Integer> expected = generate.getBlockSizes();
    provider.save(generate);/*from   w  w  w  .j a  va2  s.c om*/

    provider = new RandbXMLPersistenceProvider(TEST_DATA_FOLDER);
    BlockGroup load = provider.load(name);
    Assert.assertNotNull(load);
    Assert.assertEquals(name, load.getName());
    Assert.assertEquals(expected, load.getBlockSizes());
}

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

@Test
public void testFindUUserXRoles() {
    Assert.assertNotNull(userBO.findUUserXRoles(1L));
}

From source file:com.hybris.oms.rest.client.OmsIntegrationTest.java

@Test
public void testOrderProcessing() {
    order = helper.buildOrder(inventory.getSkuId());
    omsOrderRestClient.createOrder(order);
    final ShipmentQueryObject query = new ShipmentQueryObject();
    query.setOrderIds(Collections.singletonList(order.getOrderId()));
    int count = 0;
    Pageable<UIShipment> shipments;
    do {/*  w ww .  j  a va  2s  .  co  m*/
        helper.delay();
        shipments = omsUiShipmentRestClient.findUIShipmentsByQuery(query);
    } while (count++ < RETRIES && CollectionUtils.isEmpty(shipments.getResults()));
    Assert.assertNotNull(shipments.getResults());
    Assert.assertEquals(1, shipments.getResults().size());
    final String shipmentId = shipments.getResults().get(0).getShipmentId().toString();
    omsShipmentRestClient.confirmShipment(shipmentId);
    count = 0;
    Shipment shipment;
    do {
        helper.delay();
        shipment = omsShipmentRestClient.getShipmentById(shipmentId);
    } while (count++ < RETRIES && !"DONE".equals(shipment.getState()));
    Assert.assertEquals("DONE", shipment.getState());

    final byte[] shippingLabel = omsShipmentRestClient.retrieveShippingLabelsByShipmentId(shipmentId);
    Assert.assertNotNull(shippingLabel);
    Assert.assertTrue((new String(shippingLabel)).contains("PDF"));
}