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:ejportal.webapp.filter.StaticFilterTest.java

/**
 * Test filter forwards when path doesnt match.
 * // w  w  w  . j  a  v  a2 s .c  o m
 * @throws Exception
 *             the exception
 */
public void testFilterForwardsWhenPathDoesntMatch() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/editProfile.html");
    final MockHttpServletResponse response = new MockHttpServletResponse();
    final MockFilterChain chain = new MockFilterChain();

    this.filter.doFilter(request, response, chain);

    Assert.assertNotNull(chain.getForwardURL());
}

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

@Test
public void deleteSetting_shouldDeleteSettingWithGivenName() throws Exception {
    Setting setting = getSetting("epihandyser");
    Assert.assertNotNull(setting);

    settingService.deleteSetting(setting);
    Assert.assertNull(getSetting("epihandyser"));
}

From source file:fragment.web.StaticPagesControllerTest.java

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

From source file:org.apache.smscserver.test.spring.SpringConfigTest.java

public void test() throws Throwable {
    // FIXME: Hasan variable not expanded
    System.setProperty("SMSC_HOME", "./target/");

    XmlBeanFactory factory = new XmlBeanFactory(
            new FileSystemResource("src/test/resources/spring-config/config-spring-1.xml"));

    DefaultSmscServer server = (DefaultSmscServer) factory.getBean("server");

    Assert.assertEquals(500, server.getServerContext().getConnectionConfig().getMaxBinds());
    Assert.assertEquals(124, server.getServerContext().getConnectionConfig().getMaxBindFailures());
    Assert.assertEquals(125, server.getServerContext().getConnectionConfig().getBindFailureDelay());
    Assert.assertEquals(4, server.getServerContext().getConnectionConfig().getMinThreads());
    Assert.assertEquals(16, server.getServerContext().getConnectionConfig().getMaxThreads());
    Assert.assertEquals(2, server.getServerContext().getDeliveryManagerConfig().getManagerThreads());
    Assert.assertEquals(8, server.getServerContext().getDeliveryManagerConfig().getMinThreads());
    Assert.assertEquals(24, server.getServerContext().getDeliveryManagerConfig().getMaxThreads());

    Assert.assertEquals(1000, server.getServerContext().getSessionLockTimeout());

    Map<String, Listener> listeners = server.getServerContext().getListeners();
    Assert.assertEquals(3, listeners.size());

    Listener listener = listeners.get("listener1");
    Assert.assertNotNull(listener);
    Assert.assertTrue(listener instanceof MyCustomListener);
    Assert.assertEquals(2223, listener.getPort());

    listener = listeners.get("listener2");
    Assert.assertNotNull(listener);/*from  ww w .j a va2s.  com*/
    Assert.assertTrue(listener instanceof MyCustomListener);
    Assert.assertEquals(2224, listener.getPort());

    CommandFactory cf = server.getCommandFactory();
    Assert.assertTrue(cf.getCommand(9) instanceof BindCommand);
    Assert.assertTrue(cf.getCommand(21) instanceof EnquireLinkCommand);

    Assert.assertEquals(2, server.getSmsclets().size());
    Assert.assertEquals(123, ((TestSmsclet) server.getSmsclets().get("smsclet1")).getFoo());
    Assert.assertEquals(223, ((TestSmsclet) server.getSmsclets().get("smsclet2")).getFoo());

    Assert.assertNotNull(server.getServerContext().getMessageManager());
}

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

@Test
public void saveReportGroup_shouldSaveReport() throws Exception {
    final String reportName = "New Report";

    List<ReportGroup> reportGroups = reportsService.getReportGroups();
    Assert.assertNull(ReportGroup.getReport(reportName, reportGroups));

    ReportGroup reportGroup = reportGroups.get(0);
    Report report = new Report(reportName);
    report.setCreator(userService.getUsers().get(0));
    report.setDateCreated(new Date());
    report.setReportGroup(reportGroup);//from ww  w  . j  av a2s  .  c  o m
    reportsService.saveReport(report);

    reportGroups = reportsService.getReportGroups();
    Assert.assertNotNull(ReportGroup.getReport(reportName, reportGroups));
}

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

@Test
public void deletePermission_shouldDeleteGivenPermission() throws Exception {

    final String permissionName = "Permission Name";

    List<Permission> permissions = permissionService.getPermissions();
    Assert.assertEquals(75, permissions.size());
    Assert.assertNull(permissionService.getPermission(permissionName));

    permissionService.savePermission(new Permission(permissionName));
    permissions = permissionService.getPermissions();
    Assert.assertEquals(76, permissions.size());

    Permission permission = permissionService.getPermission(permissionName);
    Assert.assertNotNull(permission);

    permissionService.deletePermission(permission);

    permissions = permissionService.getPermissions();
    Assert.assertEquals(75, permissions.size());
    Assert.assertNull(permissionService.getPermission(permissionName));
}

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

@Test
public void startChameriaWithActivation() throws Exception {

    ChameRIA chameleon = new ChameRIA("target/core", true, null, APP_1_DIRECTORY, null, null);
    Framework framework = chameleon.start(new String[0]);

    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");

    Assert.assertEquals(1, count.get(svc));
    Assert.assertEquals(0, ((String[]) args.get(svc)).length);

    chameleon.stop();/*from  w ww . ja v  a 2s .  co m*/
}

From source file:com.cloudant.sync.datastore.BasicDatastoreTestBase.java

void validateNewlyCreateLocalDocument(BasicDocumentRevision rev) {
    Assert.assertNotNull(rev);
    CouchUtils.validateDocumentId(rev.getId());
    Assert.assertEquals("1-local", rev.getRevision());
    Assert.assertTrue(rev.isCurrent());/*from w  w  w  . j  a  va 2  s  . co  m*/
}

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

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

From source file:org.springsource.examples.expenses.TestManagedFileService.java

@Test
public void testCreatingManagedFile() throws Throwable {
    InputStream inputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream(receiptClassPath);

    ManagedFile mf = this.fileService.createManagedFile(243243, "receipt.jpg");
    Assert.assertFalse("the file's not ready", mf.isReady());
    String localPath = fileService.getLocalPathForManagedFile(mf.getId());
    OutputStream outputSteam = new FileOutputStream(localPath);
    IOUtils.copy(inputStream, outputSteam);
    IOUtils.closeQuietly(inputStream);/*from w  w  w  .  j a v  a2 s. com*/
    IOUtils.closeQuietly(outputSteam);

    fileService.setManagedFileReady(mf.getId(), true);

    Assert.assertNotNull(mf.getId());

}