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.obiba.onyx.print.impl.DefaultPrintableReportsRegistryTest.java

@Test
public void getReportByNameTest() {
    IPrintableReport report = printableReportsRegistry.getReportByName("ParticipantReport");
    Assert.assertNotNull(report);
    Assert.assertEquals(ready, report.isReady());
    Assert.assertEquals(localisable, report.isLocalisable());
    Assert.assertEquals(1, report.availableLocales().size());
}

From source file:org.openmrs.module.kenyaemr.reporting.builder.indicator.Moh711ReportTest.java

@Test
public void test() throws Exception {
    Program hivProgram = Metadata.getProgram(Metadata.HIV_PROGRAM);

    // Enroll #6 in the HIV program on June 15th
    TestUtils.enrollInProgram(Context.getPatientService().getPatient(6), hivProgram,
            TestUtils.date(2012, 6, 15), null);

    ReportDefinition rd = report.getReportDefinition();

    // Run report on all patients for June 2012
    EvaluationContext context = ReportingTestUtils.reportingContext(Arrays.asList(2, 6, 7, 8, 999),
            TestUtils.date(2012, 6, 1), TestUtils.date(2012, 6, 30));

    ReportData data = Context.getService(ReportDefinitionService.class).evaluate(rd, context);

    ReportingTestUtils.printReport(data);

    Assert.assertEquals(1, data.getDataSets().size());
    MapDataSet dataSet = (MapDataSet) data.getDataSets().get("K: ART");
    Assert.assertNotNull(dataSet);

    Assert.assertEquals(1, ((IndicatorResult) dataSet.getColumnValue(1, "K1-7-MP")).getValue().intValue());
    Assert.assertEquals(1, ((IndicatorResult) dataSet.getColumnValue(1, "K1-7-M")).getValue().intValue());
    Assert.assertEquals(1, ((IndicatorResult) dataSet.getColumnValue(1, "K1-7-T")).getValue().intValue());
}

From source file:org.sonatype.nexus.kenai.internal.KenaiRealmTest.java

@Test
public void testAuthFailAuthFail() throws Exception {
    KenaiRealm kenaiRealm = this.getRealm();

    try {//from   w w  w  .  ja  v  a  2s .c  om
        Assert.assertNotNull(
                kenaiRealm.getAuthenticationInfo(new UsernamePasswordToken("unknown-user-foo-bar", "invalid")));
        Assert.fail("Expected: AccountException to be thrown");
    } catch (AccountException e) {
        // expected
    }

    try {
        kenaiRealm.getAuthenticationInfo(new UsernamePasswordToken("random", "JUNK-PASS"));
        Assert.fail("Expected: AccountException to be thrown");
    } catch (AccountException e) {
        // expected
    }

    Assert.assertNotNull(kenaiRealm.getAuthenticationInfo(new UsernamePasswordToken(username, password)));

    try {
        kenaiRealm.getAuthenticationInfo(new UsernamePasswordToken("random", "JUNK-PASS"));
        Assert.fail("Expected: AccountException to be thrown");
    } catch (AccountException e) {
        // expected
    }
}

From source file:com.cubusmail.user.test.UserAccountDaoTest.java

/**
 * Compare test user account with the persistent one.
 *//* w w w .  j av  a  2s  .  c o  m*/
@Test
public void testGetUserAccountByUsername() {

    UserAccount userAccount = (UserAccount) this.context.getBean("testUserAccount");
    UserAccount savedUserAccount = this.userAccountDao.getUserAccountByUsername(userAccount.getUsername());
    Assert.assertNotNull(savedUserAccount);

    List<ContactFolder> contactFolders = this.userAccountDao.retrieveContactFolders(userAccount);

    Assert.assertNotNull(contactFolders);
    Assert.assertFalse(contactFolders.isEmpty());

    List<Contact> contactList = this.userAccountDao.retrieveContactList(contactFolders.get(0));
    Assert.assertNotNull(contactList);
    Assert.assertFalse(contactList.isEmpty());
    Assert.assertEquals(contactList.size(), userAccount.getContactFolders().get(0).getContactList().size());
}

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

/**
 * Test edit./* w w  w.  ja v a  2s  . co m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testEdit() throws Exception {
    this.log.debug("testing edit...");
    this.action.setKonsortiumId(1L);
    Assert.assertNull(this.action.getKonsortium());
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getKonsortium());
    Assert.assertFalse(this.action.hasActionErrors());
}

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

@Test
public void saveLocale_shouldSaveLocaleList() throws Exception {
    final String localeName = "LocaleName";
    final String localeKey = "LocaleKey";

    List<Locale> locales = localeService.getLocales();
    Assert.assertEquals(1, locales.size());
    Assert.assertNull(getLocale(localeName, locales));

    Locale locale = new Locale();
    locale.setName(localeName);//from   w  w  w  .j a  v a  2s  .  com
    locale.setKey(localeKey);
    locale.setCreator(userService.getUsers().get(0));
    locale.setDateCreated(new Date());

    locales = new ArrayList<Locale>();
    locales.add(locale);

    localeService.saveLocale(locales);

    locales = localeService.getLocales();
    Assert.assertEquals(2, locales.size());
    Assert.assertNotNull(getLocale(localeName, locales));
}

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

@Test
public void shouldGetOrderAsRef() throws Exception {
    request.setParameter(RestConstants.REQUEST_PROPERTY_FOR_REPRESENTATION,
            Representation.REF.getRepresentation());
    Object o = controller.retrieve(ORDER_UUID, request);
    Assert.assertEquals(ORDER_UUID, PropertyUtils.getProperty(o, "uuid"));
    Assert.assertNotNull(PropertyUtils.getProperty(o, "display"));
    Assert.assertNull(PropertyUtils.getProperty(o, "concept"));
    Util.log("order as ref", o);
}

From source file:com.chrisjansen.jms.gateway.JMSGatewayTest.java

@Test
public void testGatewayDemo() throws InterruptedException {

    final MessageChannel stdinToJmsoutChannel = applicationContext.getBean("stdinToJmsoutChannel",
            MessageChannel.class);

    stdinToJmsoutChannel.send(MessageBuilder.withPayload("activemq jms test").build());

    final QueueChannel queueChannel = applicationContext.getBean("queueChannel", QueueChannel.class);

    Message<String> reply = (Message<String>) queueChannel.receive(60000);
    Assert.assertNotNull(reply);

    String out = reply.getPayload();
    Assert.assertEquals("JMS response: ACTIVEMQ JMS TEST", out);
}

From source file:fragment.web.StaticPagesControllerTest.java

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

From source file:com.ancientprogramming.fixedformat4j.format.impl.TestFixedFormatManagerImpl.java

public void testLoadMultibleFieldsRecord() {
    //when reading data having multible field annotations the first field will decide what data to return
    Calendar someDay = Calendar.getInstance();
    someDay.set(2008, 9, 13, 0, 0, 0);/* w  ww.  j  av a2 s.  c om*/
    someDay.set(Calendar.MILLISECOND, 0);
    MultibleFieldsRecord loadedRecord = manager.load(MultibleFieldsRecord.class, MULTIBLE_RECORD_DATA);
    Assert.assertNotNull(loadedRecord);
    Assert.assertEquals("some      ", loadedRecord.getStringData());
    Assert.assertEquals(someDay.getTime(), loadedRecord.getDateData());
}