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.rest19ext.web.v1_0.controller.LocationAttributeControllerTest.java

@Test
public void shouldListAttributesForLocation() throws Exception {
    SimpleObject result = controller.getAll(Rest19ExtTestConstants.LOCATION_UUID, request, response);
    Assert.assertNotNull(result);
    Assert.assertEquals(2, Util.getResultsSize(result));
}

From source file:de.hybris.platform.integration.cis.payment.strategies.impl.CisPaymentResponseInterpretationStrategyIntegrationTest.java

@Test
public void testValidPaymentResponseInterpretation() throws Exception {
    final RestResponse hpfUrl = this.paymentClient.pspUrl("test");
    final String testClientRef = "JUNIT-TEST-CLIENT";
    final List<BasicNameValuePair> validFormData = CisPaymentIntegrationTestHelper.getValidFormDataMap();
    final Map<String, String> profileCreationResponse = CisPaymentIntegrationTestHelper
            .createNewProfile(hpfUrl.getLocation().toASCIIString(), validFormData);
    final Map<String, PaymentErrorField> errors = new HashMap<String, PaymentErrorField>();

    final CreateSubscriptionResult subscriptionResult = cisPaymentResponseInterpretation
            .interpretResponse(profileCreationResponse, testClientRef, errors);
    Assert.assertNotNull(subscriptionResult);
    Assert.assertNotNull(subscriptionResult.getDecision());
    Assert.assertNotNull(subscriptionResult.getReasonCode());

    if (!subscriptionResult.getReasonCode().equals(CispaymentConstants.HYSTRIX_FALLBACK_ERR_CODE)) {
        Assert.assertEquals(DecisionsEnum.ACCEPT.name(), subscriptionResult.getDecision());
    } else//  ww w  .  j a  v a  2s  .  c o  m
    // Hystrix fallback unexpectedly executed. Assert Decision was set to ERROR
    {
        Assert.assertEquals(DecisionsEnum.ERROR.name(), subscriptionResult.getDecision());
    }
}

From source file:org.mayocat.theme.ThemeDefinitionTest.java

@Test
public void testParsePagination() throws Exception {
    String themeConfig = Resources.toString(Resources.getResource("pagination-theme.yml"), Charsets.UTF_8);
    ThemeDefinition theme = mapper.readValue(themeConfig, ThemeDefinition.class);

    Map<String, PaginationDefinition> paginationDefinitions = theme.getPaginationDefinitions();

    Assert.assertNotNull(paginationDefinitions.get("products"));
    Assert.assertEquals(new Integer(10), paginationDefinitions.get("products").getItemsPerPage());

    PaginationDefinition collection = paginationDefinitions.get("collection");
    Assert.assertNotNull(collection);//from  w ww . ja v  a2 s . c om
    Assert.assertEquals(new Integer(25), collection.getItemsPerPage());
    Assert.assertNotNull(collection.getModels().get("custom-model"));
    Assert.assertEquals(new Integer(12), collection.getModels().get("custom-model").getItemsPerPage());
}

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

/**
 * Test save./*w  w w .  j  ava  2 s  .co m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setSigelId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getSigel());

    // update Sigelname and save
    this.action.getSigel().setName("Updated Name");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Name", this.action.getSigel().getName());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

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

/**
 * Test save.//from w  w w  . j  a  v  a2  s .com
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setPaketId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getPaket());

    // update Paketname and save
    this.action.getPaket().setPaketName("Updated Name");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Name", this.action.getPaket().getPaketName());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

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

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

    CellData data = new CellData(new CellReference("A1"), new Formula("=B1 + 10"));
    sheet.sendCommand(cellCommands.copyContent(new AreaReference("C2:C3"), data));

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

    CellData newData2 = sheet.receiveCell(new CellReference("C3")).getNonBlocking();
    Assert.assertNotNull(newData2);//  w w w .j a v  a 2  s  . c o m
    Assert.assertEquals(new Formula("=D3 + 10"), newData2.getFormula());
}

From source file:it.geosolutions.geostore.services.rest.auditing.AuditingConfigurationTest.java

@Test
public void testUpdateConfiguration() {
    AuditingConfiguration auditingConfiguration = new AuditingConfiguration();
    Assert.assertEquals(auditingConfiguration.isAuditEnable(), true);
    Map<String, String> properties = AuditingTestsUtils.getDefaultProperties();
    properties.put(AuditingConfiguration.AUDIT_ENABLE, "false");
    AuditingTestsUtils.createFile(AuditingTestsUtils.CONFIGURATION_FILE_PATH,
            AuditingTestsUtils.propertiesToString(properties));
    AuditingConfiguration newAuditingConfiguration = auditingConfiguration.checkForNewConfiguration();
    Assert.assertNotNull(newAuditingConfiguration);
}

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

@Test
public void shouldListAttributesForAVisitExcludingVoidedOnes() throws Exception {
    SimpleObject result = controller.getAll(Rest19ExtTestConstants.VISIT_UUID, request, response);
    Assert.assertNotNull(result);
    Assert.assertEquals(1, Util.getResultsSize(result));
}

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

@Test
public void shouldGetOrderAsDefault() throws Exception {
    Object o = controller.retrieve(ORDER_UUID, request);
    Assert.assertEquals(ORDER_UUID, PropertyUtils.getProperty(o, "uuid"));
    Assert.assertNotNull(PropertyUtils.getProperty(o, "display"));
    Assert.assertNotNull(PropertyUtils.getProperty(o, "patient"));
    Assert.assertNotNull(PropertyUtils.getProperty(o, "concept"));
    Util.log("drug order as ref", o);
}

From source file:de.akquinet.gomobile.androlog.test.MailReporterTest.java

public void testMail() {
    Log.init(getContext());//from   w  ww . j a v a  2  s .  co m
    String message = "This is a INFO test";
    String tag = "my.log.info";
    Log.d(tag, message);
    Log.i(tag, message);
    Log.w(tag, message);
    List<String> list = Log.getReportedEntries();
    Assert.assertNotNull(list);
    Assert.assertFalse(list.isEmpty());
    Assert.assertEquals(2, list.size()); // i + w

    Log.report();
    Log.report("this is a user message", null);
    Exception error = new MalformedChallengeException("error message", new NumberFormatException());
    Log.report(null, error);
}