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.action.RechnungActionTest.java

/**
 * Test remove.//from  ww w.  ja  v  a2 s.  c  o m
 * 
 * @throws Exception
 *             the exception
 */
public void testRemove() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setDelete("");
    final Rechnung rechnung = new Rechnung();
    rechnung.setRechnungId(2L);
    // action.setRechnung(rechnung);
    this.action.setRechnungId(2L);
    Assert.assertEquals("success", this.action.delete());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

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

/**
 * Test remove.//  w ww  . java2  s. c  om
 * 
 * @throws Exception
 *             the exception
 */
public void testRemove() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setDelete("");
    final Besteller besteller = new Besteller();
    besteller.setBestellerId(2L);
    // action.setBesteller(besteller);
    this.action.setBestellerId(2L);
    Assert.assertEquals("success", this.action.delete());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

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

/**
 * @see ObsController#getObsByPatientId(String,WebRequest)
 * @verifies get a default representation of all obs
 *//*from  w  w  w  . j  a va 2s . co m*/
@Test
public void getObsByPatientId_shouldGetADefaultRepresentationOfAllObs() throws Exception {
    List<Object> results = (List<Object>) new ObsController()
            .search("6TS-4", emptyRequest(), new MockHttpServletResponse()).get("results");
    Assert.assertNotNull(results);
    Object result = results.get(8);
    Assert.assertEquals(9, results.size());
    Assert.assertNotNull(PropertyUtils.getProperty(result, "links"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "display"));
}

From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java

/**
 * This test is breaking often because the client response varies ..Changing from news.ycombinator.com to google.com
 * @throws Exception/*from  ww  w  .j  a  va 2 s. c om*/
 */
@Test
public void shouldAddBookmark() throws Exception {
    final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open");
    final InstaRecordBean instaRecordBean = client.addBookmark("http://google.com/", null, null, null);
    Assert.assertNotNull(instaRecordBean);
    Assert.assertEquals("bookmark", instaRecordBean.type);
    Assert.assertEquals("Google", instaRecordBean.title);
    Assert.assertEquals("http://www.google.com/", instaRecordBean.url);
    Assert.assertEquals("", instaRecordBean.description);
    Assert.assertNotNull(instaRecordBean.hash);
    Assert.assertNotNull(instaRecordBean.progress_timestamp);
    Assert.assertNotNull(instaRecordBean.time);
    Assert.assertNotNull(instaRecordBean.starred);
    Assert.assertNotNull(instaRecordBean.progress);
    Assert.assertNotNull(instaRecordBean.private_source);
    instaRecordBean.toString();
}

From source file:io.cloudslang.engine.queue.services.ExecutionQueueServiceTest.java

@Test
public void enqueueTest() throws Exception {
    Multimap<String, String> groupWorkerMap = ArrayListMultimap.create();
    groupWorkerMap.put("group1", "worker3");
    groupWorkerMap.put("group2", "worker3");
    when(workerNodeService/*from w ww .  j  a v  a2s.  c om*/
            .readGroupWorkersMapActiveAndRunningAndVersion(engineVersionService.getEngineVersionId()))
                    .thenReturn(groupWorkerMap);

    ExecutionMessage message1 = generateMessage("group1", "11");
    ExecutionMessage message2 = generateMessage("group2", "12");
    List<ExecutionMessage> msgs = new ArrayList<>();
    msgs.add(message1);
    msgs.add(message2);
    executionQueueService.enqueue(msgs);

    List<ExecutionMessage> msgInQueue, msgFromQueue;
    msgInQueue = executionQueueService.pollRecovery("worker3", 100, ExecStatus.ASSIGNED);
    Assert.assertEquals(2, msgInQueue.size());
    Assert.assertNotNull(msgInQueue.get(0).getPayload().getData());

    msgInQueue = updateMessages(msgInQueue, ExecStatus.ASSIGNED, "worker1");
    executionQueueService.enqueue(msgInQueue);
    msgFromQueue = executionQueueService.pollRecovery("worker1", 100, ExecStatus.ASSIGNED);
    Assert.assertEquals(2, msgFromQueue.size());
    msgFromQueue = executionQueueService.pollRecovery("worker2", 100, ExecStatus.ASSIGNED);
    Assert.assertEquals(0, msgFromQueue.size());

    msgInQueue = updateMessages(msgInQueue, ExecStatus.SENT, "worker1");
    executionQueueService.enqueue(msgInQueue);
    msgFromQueue = executionQueueService.pollRecovery("worker1", 100, ExecStatus.SENT);
    Assert.assertEquals(ExecStatus.SENT, msgFromQueue.get(0).getStatus());
    Assert.assertEquals(2, msgFromQueue.size());

    msgInQueue = updateMessages(msgInQueue, ExecStatus.IN_PROGRESS, "worker1");
    executionQueueService.enqueue(msgInQueue);
    msgFromQueue = executionQueueService.pollRecovery("worker1", 100, ExecStatus.IN_PROGRESS);
    Assert.assertEquals(ExecStatus.IN_PROGRESS, msgFromQueue.get(0).getStatus());
    Assert.assertEquals(2, msgFromQueue.size());

    msgInQueue = updateMessages(msgInQueue, ExecStatus.FINISHED, "worker1");
    executionQueueService.enqueue(msgInQueue);
    msgFromQueue = executionQueueService.pollRecovery("worker1", 100, ExecStatus.FINISHED);
    Assert.assertEquals(ExecStatus.FINISHED, msgFromQueue.get(0).getStatus());
    Assert.assertEquals(2, msgFromQueue.size());

}

From source file:com.projity.exchange.MicrosoftImporterTest.java

@Test
public void testMppImport() throws Exception {
    LoadOptions opts = new LoadOptions();
    opts.setLocal(true);/*from  w w w  .  j  a  v  a  2 s  .  c o  m*/
    opts.setSync(true);
    opts.setLocal(true);
    opts.setImporter(LocalSession.MICROSOFT_PROJECT_IMPORTER);
    opts.setFileName(mppFileName);
    Project project = pf.openProject(opts);
    Assert.assertNotNull(project);
}

From source file:com.cemeterylistingswebtest.test.domain.PublishedDeceasedListingTest.java

@Test(dependsOnMethods = "create")
public void read() {
    repoList = ctx.getBean(PublishedDeceasedListingRepository.class);
    Assert.assertEquals(repoList.findOne(id).getFirstName(), "Hendrika");
    Assert.assertEquals(repoList.findOne(id).getSurname(), "Fourie");
    Assert.assertEquals(repoList.findOne(id).getMaidenName(), "Gerber");
    Assert.assertEquals(repoList.findOne(id).getGender(), "Female");
    Assert.assertEquals(repoList.findOne(id).getDateOfBirth(), "08/06/1969");
    Assert.assertEquals(repoList.findOne(id).getDateOfDeath(), "14/02/2005");
    Assert.assertEquals(repoList.findOne(id).getGraveInscription(), "Hippiest person eva");
    Assert.assertEquals(repoList.findOne(id).getGraveNumber(), "2456");
    Assert.assertEquals(repoList.findOne(id).getImageOfBurialSite(), "/images/001.jpg");
    Assert.assertEquals(repoList.findOne(id).getLastKnownContactName(), "Berry");
    Assert.assertEquals(repoList.findOne(id).getLastKnownContactNumber(), "0725576482");

    Assert.assertNotNull(repoList.findOne(id).getSubscriberSubmitID());
}

From source file:com.couchbase.lite.BlobStoreTest.java

public void testBlobStoreWriter() throws Exception {
    if (!isSQLiteDB())
        return;//from ww w  . j  a  v a2 s  . co m

    BlobStoreWriter writer = new BlobStoreWriter(store);
    Assert.assertNotNull(writer);

    writer.appendData("part 1, ".getBytes("UTF8"));
    writer.appendData("part 2, ".getBytes("UTF8"));
    writer.appendData("part 3".getBytes("UTF8"));
    writer.finish();
    Assert.assertTrue(writer.install());

    byte[] expectedData = "part 1, part 2, part 3".getBytes("UTF8");
    byte[] readItem = store.blobForKey(writer.getBlobKey());
    Assert.assertTrue(Arrays.equals(readItem, expectedData));
    verifyRawBlob(writer.getBlobKey(), expectedData);
}

From source file:eu.trentorise.smartcampus.ac.provider.repository.persistence.AcDaoPersistenceImplTest.java

@Test
public void searchAuthorityByName() {
    Assert.assertNotNull(dao.readAuthorityByName(AUTH_NAME_PRESENT));
    Assert.assertNull(dao.readAuthorityByName(AUTH_NAME_NOT_PRESENT));

}

From source file:com.connectsdk.service.FireTVServiceTest.java

@Test
public void testInitialState() {
    Assert.assertNotNull(service);
}