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:walkAlong.prac1Test.java

@Test
public void soon() {
    Assert.assertNull(obj.st1());
}

From source file:com.asptt.plongee.resa.service.AdherentServiceTest.java

@Test
public void testRechercherAdherentParIdentifiant() throws TechnicalException {
    // recherche d'un inconnu
    Adherent inconnu = adherentService.rechercherAdherentParIdentifiant("identifiant n'existant pas");
    Assert.assertNull(inconnu);
}

From source file:com.collective.celos.FileSystemStateDatabaseTest.java

@Test
public void emptyDatabaseReturnsNull() throws Exception {
    StateDatabaseConnection db = getStateDatabaseConnection();
    Assert.assertNull(
            db.getSlotState(new SlotID(new WorkflowID("workflow-1"), new ScheduledTime("2013-12-02T13:37Z"))));
}

From source file:com.swcguild.contactlistmvc.dao.ContactListDaoTest.java

@Test
public void addGetDeleteContact() {
    Contact nc = new Contact();
    nc.setFirstName("John");
    nc.setLastName("Doe");
    nc.setCompany("Oracle");
    nc.setEmail("john@doe.com");
    nc.setPhone("1234445678");

    dao.addContact(nc);/*w w w  . j  a  v  a 2 s.  co m*/

    Contact fromDb = dao.getContactById(nc.getContactId());

    Assert.assertEquals(fromDb, nc);

    dao.removeContact(nc.getContactId());

    Assert.assertNull(dao.getContactById(nc.getContactId()));

}

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

@Test
public void getSetting_shouldReturnNullIfNoSettingFoundWithGivenName() throws Exception {
    Assert.assertNull(settingService.getSetting("some non existing setting name"));
}

From source file:DvdLibraryDaoTest.java

@Test
public void addGetDeleteDvd() throws ParseException {

    Dvd d = new Dvd();
    d.setTitle("Whiplash");
    d.setReleaseDate(sdf.parse("10/15/2014"));
    d.setMpaaRating("R");
    d.setDirectorName("Damien Chazelle");
    d.setStudio("Sony Pictures");
    d.setUserNote("Provocative and emotional");

    dao.addDVD(d);/*from  w ww  . j  ava2s .com*/

    Dvd fromDb = dao.findDVDByID(d.getDvdId());

    Assert.assertEquals(fromDb, d);

    dao.removeDVD(d.getDvdId());

    Assert.assertNull(dao.findDVDByID(d.getDvdId()));

}

From source file:com.ktds.ldap.populator.AttributeCheckContextMapper.java

public DirContextAdapter mapFromContext(Object ctx) {
    DirContextAdapter adapter = (DirContextAdapter) ctx;
    Assert.assertEquals("Values and attributes need to have the same length ", expectedAttributes.length,
            expectedValues.length);/*from  ww w  .j ava 2 s.c  om*/
    for (int i = 0; i < expectedAttributes.length; i++) {
        String attributeValue = adapter.getStringAttribute(expectedAttributes[i]);
        Assert.assertNotNull("Attribute " + expectedAttributes[i] + " was not present", attributeValue);
        Assert.assertEquals(expectedValues[i], attributeValue);
    }

    for (String absentAttribute : absentAttributes) {
        Assert.assertNull(adapter.getStringAttribute(absentAttribute));
    }

    return adapter;
}

From source file:com.google.api.ads.adwords.awreporting.model.persistence.sql.SqlAuthTokenPersisterTest.java

/**
 * Tests the persistence and retrieval of the token.
 *///  www  . java  2s .c o m
@Test
public void testTokenPersistence() {

    AuthMcc authMcc = new AuthMcc("1234", "Name", "4321", "scope");
    this.authTokenPersister.persistAuthToken(authMcc);

    AuthMcc authToken = this.authTokenPersister.getAuthToken("1234");
    Assert.assertNotNull(authToken);
    Assert.assertEquals("4321", authToken.getAuthToken());

    authToken = this.authTokenPersister.getAuthToken("12345");
    Assert.assertNull(authToken);

    authMcc = new AuthMcc("1234", "Name", "54321", "scope");
    this.authTokenPersister.persistAuthToken(authMcc);

    authToken = this.authTokenPersister.getAuthToken("1234");
    Assert.assertNotNull(authToken);
    Assert.assertEquals("54321", authToken.getAuthToken());
}

From source file:org.jrecruiter.service.JobServiceTest.java

@Test
public void testDeleteJobForIdTest() throws Exception {
    final Job job = this.getJob();

    User user = this.getUser();
    User savedUser = userDao.save(user);
    job.setUser(savedUser);//  w w  w.j a  va 2  s .  c  o m
    Job savedJob = jobService.addJob(job);

    Job job2 = jobService.getJobForId(savedJob.getId());
    Assert.assertNotNull(job2);
    jobService.deleteJobForId(job2.getId());

    Assert.assertNull(jobService.getJobForId(savedJob.getId()));
}

From source file:com.ktds.ldap.populator.AttributeCheckAttributesMapper.java

public Object mapFromAttributes(Attributes attributes) throws NamingException {
    Assert.assertEquals("Values and attributes need to have the same length ", expectedAttributes.length,
            expectedValues.length);//from w w w  .  ja va 2s  .  co m
    for (int i = 0; i < expectedAttributes.length; i++) {
        Attribute attribute = attributes.get(expectedAttributes[i]);
        Assert.assertNotNull("Attribute " + expectedAttributes[i] + " was not present", attribute);
        Assert.assertEquals(expectedValues[i], attribute.get());
    }

    for (String absentAttribute : absentAttributes) {
        Assert.assertNull(attributes.get(absentAttribute));
    }

    return null;
}