Example usage for junit.framework Assert assertNull

List of usage examples for junit.framework Assert assertNull

Introduction

In this page you can find the example usage for junit.framework Assert assertNull.

Prototype

static public void assertNull(Object object) 

Source Link

Document

Asserts that an object is null.

Usage

From source file:org.jasig.schedassist.impl.SchedulingAssistantServiceImplTest.java

/**
 * Expect {@link AvailableServiceImpl#scheduleAppointment(ScheduleVisitor, ScheduleOwner, AvailableBlock, String)}
 * to return null for {@link ScheduleOwner#isSamePerson(ScheduleVisitor)} returning true.
 * @throws Exception/*from  w w w.j a va 2 s  . c  o  m*/
 */
@Test
public void testScheduleAppointmentOwnerVisitorSamePerson() throws Exception {
    // construct a schedule owner
    MockCalendarAccount ownerAccount = new MockCalendarAccount();
    ownerAccount.setUsername("user1");
    DefaultScheduleOwnerImpl owner = new DefaultScheduleOwnerImpl(ownerAccount, 1);

    // construct a schedule visitor from same person
    DefaultScheduleVisitorImpl visitor = new DefaultScheduleVisitorImpl(ownerAccount);

    // construct target availableblock for appointment
    AvailableBlock targetBlock = AvailableBlockBuilder.createBlock("20091111-1330", "20091111-1400", 1);

    SchedulingAssistantServiceImpl serviceImpl = new SchedulingAssistantServiceImpl();
    Assert.assertNull(serviceImpl.scheduleAppointment(visitor, owner, targetBlock, "description"));
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceGroupConfigBeanDefinitionParserTest.java

@Test
public void testService1() {
    final RemoteServiceGroupConfig config;
    RemoteServiceConfig serviceConfig;//from ww  w . ja v  a2  s.c o  m
    Iterator<RemoteServiceConfig> serviceConfigIter;

    config = appContext2.getBean("serviceGroup1", RemoteServiceGroupConfig.class);
    Assert.assertEquals(7, config.getServiceConfigs().size());
    serviceConfigIter = config.getServiceConfigs().iterator();

    serviceConfig = serviceConfigIter.next(); /* 0 */
    Assert.assertEquals("testService10", serviceConfig.getServiceName());
    Assert.assertEquals(TestService11.class, serviceConfig.getServiceInterface());
    Assert.assertNull(serviceConfig.getRelativePath());
    Assert.assertNull(serviceConfig.getResponseCompressionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenProtectionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenValidatorName());

    serviceConfig = serviceConfigIter.next(); /* 1 */
    Assert.assertEquals("testService1", serviceConfig.getServiceName());
    Assert.assertNull(serviceConfig.getServiceInterface());
    Assert.assertNull(serviceConfig.getRelativePath());

    serviceConfig = serviceConfigIter.next(); /* 2 */
    Assert.assertEquals("testService2", serviceConfig.getServiceName());
    Assert.assertNull(serviceConfig.getServiceInterface());
    Assert.assertTrue(serviceConfig.getResponseCompressionEnabled());
    Assert.assertTrue(serviceConfig.getRpcTokenProtectionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenValidatorName());

    serviceConfig = serviceConfigIter.next(); /* 3 */
    Assert.assertEquals("testService3", serviceConfig.getServiceName());
    Assert.assertFalse(serviceConfig.getResponseCompressionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenProtectionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenValidatorName());

    serviceConfig = serviceConfigIter.next(); /* 4 */
    Assert.assertEquals("testService4", serviceConfig.getServiceName());
    Assert.assertNull(serviceConfig.getResponseCompressionEnabled());
    Assert.assertFalse(serviceConfig.getRpcTokenProtectionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenValidatorName());

    serviceConfig = serviceConfigIter.next(); /* 5 */
    Assert.assertEquals("testService5", serviceConfig.getServiceName());
    Assert.assertNull(serviceConfig.getResponseCompressionEnabled());
    Assert.assertNull(serviceConfig.getRpcTokenProtectionEnabled());
    Assert.assertEquals("myRpcTokenValidator", serviceConfig.getRpcTokenValidatorName());

    serviceConfig = serviceConfigIter.next(); /* 6 */
    Assert.assertEquals("testService20", serviceConfig.getServiceName());
    Assert.assertEquals("other/20special.service", serviceConfig.getRelativePath());
}

From source file:org.sakaiproject.crudplus.logic.test.CrudPlusLogicImplTest.java

/**
 * Test method for {@link org.sakaiproject.crudplus.logic.impl.CrudPlusLogicImpl#getItemById(java.lang.Long)}.
 *//*from w  ww .j  a v  a  2  s. c om*/
public void testGetItemById() {
    CrudPlusItem item = logicImpl.getItemById(item1.getId());
    Assert.assertNotNull(item);
    Assert.assertEquals(item, item1);

    CrudPlusItem baditem = logicImpl.getItemById(new Long(9999999));
    Assert.assertNull(baditem);

    try {
        logicImpl.getItemById(null);
        Assert.fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        Assert.assertNotNull(e.getMessage());
        log.info("Could not get null item (this is correct)");
    }
}

From source file:com.link_intersystems.lang.ContextAwareTest.java

@Test
public void proxy() throws Exception {
    final TestContextAware contextAware = new TestContextAware();
    TargetInterface targetInterface = createStrictMock(TargetInterface.class);

    expect(targetInterface.concat("HELLO ", "WORLD")).andAnswer(new IAnswer<String>() {

        public String answer() throws Throwable {
            assertTrue(contextAware.isActivated());
            Method2 method = contextAware.getInvocationMethod();
            Assert.assertNotNull(method);
            Method declaredMethod = TargetInterface.class.getDeclaredMethod("concat", String.class,
                    String.class);
            Assert.assertEquals(declaredMethod, method.getMember());
            return "Hello World";
        }/*from   w w w .ja  va  2s  . c om*/
    });

    replay(targetInterface);
    TargetInterface targetInterfaceContextAware = contextAware.createContextProxy(targetInterface);
    Method2 method = contextAware.getInvocationMethod();
    Assert.assertNull(method);
    String concat = targetInterfaceContextAware.concat("HELLO ", "WORLD");
    method = contextAware.getInvocationMethod();
    Assert.assertNull(method);
    assertEquals("Hello World", concat);
    assertFalse(contextAware.isActivated());
}

From source file:com.kmaismith.chunkclaim.Data.DataManagerTest.java

@Test
public void testAddChunkWillAddAChunkToTheCollection() {
    Location location1 = helpers.newLocation("world", 123, 321);
    ChunkData chunk1 = helpers.newChunkData("player", new ArrayList<String>(), location1);
    Assert.assertNull(systemUnderTest.getChunkAt(location1));
    systemUnderTest.addChunk(chunk1);/*from  www  .  j  a  va 2 s  .  co  m*/
    Assert.assertNotNull(systemUnderTest.getChunkAt(location1));
}

From source file:org.motechproject.mobile.core.dao.hibernate.GatewayResponseDAOImplTest.java

@Test
public void testDelete() {
    System.out.println("Delete Response");

    rDDAO.delete(gr2);/*from  ww w . j a  v a 2s  .com*/

    GatewayResponse fromdb = (GatewayResponseImpl) rDDAO.getSessionFactory().getCurrentSession()
            .get(GatewayResponseImpl.class, gr2.getId());
    Assert.assertNull(fromdb);
}

From source file:org.obiba.onyx.core.etl.participant.impl.XmlParticipantReaderTest.java

/**
 * Tests processing of an appointment list where a mandatory attribute (Enrollment ID, at line 4) has not been
 * assigned a value. Reader should not return an error as it is a validation done in the ParticipantProcessor.
 * //from   ww  w  . ja  v a2 s  . c  o m
 * @throws IOException if the appointment list could not be read
 */
@Test
public void testProcessWithMissingMandatoryAttributeValue() throws IOException {
    XmlParticipantReaderForTest reader = createXmlParticipantReaderForTest(false,
            TEST_RESOURCES_DIR + "/appointmentList_missingMandatoryAttributeValue.xml");
    reader.setColumnNameToAttributeNameMap(columnNameToAttributeNameMap);
    reader.setParticipantMetadata(participantMetadata);

    reader.open(context);
    List<Participant> participants = new ArrayList<Participant>();

    try {
        while (reader.getIterator().hasNext()) {
            Participant participant = reader.read();
            if (participant != null)
                participants.add(participant);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    Assert.assertEquals(3, participants.size());
    Assert.assertEquals("Tremblay", participants.get(0).getLastName());
    Assert.assertEquals("100001", participants.get(0).getEnrollmentId());
    Assert.assertEquals("Smith", participants.get(1).getLastName());
    Assert.assertNull(participants.get(1).getEnrollmentId());
    Assert.assertEquals("Casserly", participants.get(2).getLastName());
    Assert.assertNull(participants.get(2).getEnrollmentId());
}

From source file:com.kmaismith.chunkclaim.Data.DataManagerTest.java

@Test
public void testAddChunkWillAddChunkToDataStore() {
    Location location1 = helpers.newLocation("world", 123, 321);
    ChunkData chunk1 = helpers.newChunkData("player", new ArrayList<String>(), location1);
    Assert.assertNull(chunk1.getFile());
    chunk1 = systemUnderTest.addChunk(chunk1);
    Assert.assertTrue(chunk1.getFile().exists());

}

From source file:org.soybeanMilk.test.unit.web.TestDefaultWebObjectSource.java

@Test
public void get_paramScope_valueIsNull() throws Exception {
    Object re = webObjectSource.get("param.key", Integer.class);

    Assert.assertNull(re);
}