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:com.nokia.dempsy.router.TestRouterClusterManagement.java

@Test
public void testGetRouterNotFound() {
    Set<ClusterRouter> router = routerFactory.getRouter(java.lang.String.class);
    Assert.assertNull(router);
    Assert.assertTrue(routerFactory.missingMsgTypes.containsKey(java.lang.String.class));
}

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

@Test
public void deleteForm_shouldDeleteGivenForm() throws Exception {

    final String formName = "Form Name";

    List<FormDef> forms = studyManagerService.getForms();
    int numberOfForms = forms.size();

    FormDef form = new FormDef();
    form.setName(formName);/* w ww .  j  a v a 2s . com*/
    form.setCreator(userService.getUsers().get(0));
    form.setDateCreated(new Date());

    studyManagerService.saveForm(form);
    forms = studyManagerService.getForms();
    Assert.assertEquals("Added one form, so now there is one more", (numberOfForms + 1), forms.size());
    form = getForm(formName, forms);
    Assert.assertNotNull(form);

    studyManagerService.deleteForm(form);

    forms = studyManagerService.getForms();
    Assert.assertEquals("Deleted the form, so now there is the same", numberOfForms, forms.size());
    Assert.assertNull(getForm(formName, forms));
}

From source file:com.cloudant.sync.util.JSONUtilsTest.java

@Test
public void deserialize_documentWithId_idAndRevShouldBeDeserialized() {
    String expectedJson = "{\"foo\":\"haha\", \"_id\":\"someId\"}";
    Foo foo = JSONUtils.deserialize(expectedJson.getBytes(), Foo.class);
    Assert.assertEquals("haha", foo.getFoo());
    Assert.assertEquals("someId", foo.getId());
    Assert.assertNull(foo.getRevision());
}

From source file:org.netxilia.spi.impl.formula.TestFindAndFilter.java

@Test
public void testFindWrongFormula() throws NetxiliaResourceException, NetxiliaBusinessException {
    ISheet sheet = SheetUtils.sheetWithCell("A1", 200, "A2", "200", "A3", 200.0);
    CellReference ref1 = operations.find(sheet, null, new Formula("=A1=200+")).getNonBlocking();
    Assert.assertNull(ref1);
}

From source file:com.netflix.curator.framework.recipes.locks.TestReaper.java

@Test
public void testUsingLeader() throws Exception {
    final Timing timing = new Timing();
    final CuratorFramework client = makeClient(timing, null);
    final CountDownLatch latch = new CountDownLatch(1);
    LeaderSelectorListener listener = new LeaderSelectorListener() {
        @Override/*w  w w  .ja  va  2s.co m*/
        public void takeLeadership(CuratorFramework client) throws Exception {
            Reaper reaper = new Reaper(client, 1);
            try {
                reaper.addPath("/one/two/three", Reaper.Mode.REAP_UNTIL_DELETE);
                reaper.start();

                timing.sleepABit();
                latch.countDown();
            } finally {
                IOUtils.closeQuietly(reaper);
            }
        }

        @Override
        public void stateChanged(CuratorFramework client, ConnectionState newState) {
        }
    };
    LeaderSelector selector = new LeaderSelector(client, "/leader", listener);
    try {
        client.start();
        client.create().creatingParentsIfNeeded().forPath("/one/two/three");

        Assert.assertNotNull(client.checkExists().forPath("/one/two/three"));

        selector.start();
        timing.awaitLatch(latch);

        Assert.assertNull(client.checkExists().forPath("/one/two/three"));
    } finally {
        IOUtils.closeQuietly(selector);
        IOUtils.closeQuietly(client);
    }
}

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

@Test
public void searchUserById() {
    User u = dao.readUser(2);
    Assert.assertNotNull(u);
    u = dao.readUser(1000);
    Assert.assertNull(u);
}

From source file:com.dianping.dpsf.centralstat.test.CentralStatTestCase.java

@Test
public void testFutureTimeout() throws Exception {
    log.info("$$$$$$$$$$testFutureTimeout");
    String ret = null;// ww w .j a  v a2 s  .  co  m
    try {
        CentralStatTestService service = (CentralStatTestService) context
                .getBean("centralStatTestServiceFuture");
        service.invokeFutureTimeOut("testFutureTimeout");
        ret = (String) ServiceFutureFactory.getFuture()._get();
        Assert.fail();
    } catch (Throwable e) {
        Assert.assertNull(ret);
    }

}

From source file:org.netxilia.spi.impl.format.TestStyleService.java

@Test
public void testClear() throws NetxiliaResourceException, NetxiliaBusinessException {
    Styles style = styleService.applyStyle(new WorkbookId("SYSTEM"), null, Styles.valueOf("u s"),
            StyleApplyMode.clear);//from ww  w.  j  av  a2  s . c o  m

    Assert.assertNull(style);

    style = styleService.applyStyle(new WorkbookId("SYSTEM"), Styles.valueOf("b i"), Styles.valueOf("i s"),
            StyleApplyMode.clear);

    Assert.assertEquals(Styles.valueOf("b"), style);

    style = styleService.applyStyle(new WorkbookId("SYSTEM"), Styles.valueOf("b i"), null,
            StyleApplyMode.clear);

    Assert.assertEquals(Styles.valueOf("b i"), style);

    // toggle
    style = styleService.applyStyle(new WorkbookId("SYSTEM"), Styles.valueOf("b a-l"), Styles.valueOf("u a-c"),
            StyleApplyMode.clear);

    Assert.assertEquals(Styles.valueOf("b"), style);
}

From source file:io.cloudslang.worker.execution.reflection.ReflectionAdapterTest.java

@Test
public void executeControlActionTest_4() {
    ControlActionMetadata metadata = new ControlActionMetadata(
            "io.cloudslang.worker.execution.reflection.ReflectionAdapterTestHelperNoSpring", "myMethod_4");
    Map<String, Object> actionData = new HashMap<>();
    actionData.put("parameter_1", 5);
    actionData.put("parameter_2", 3);
    @SuppressWarnings("unchecked")
    Map<String, ?> result = (Map<String, ?>) adapter.executeControlAction(metadata, actionData);
    Assert.assertNull(result);
}

From source file:com.impetus.kundera.EntityManagerImplTest.java

@Test
public void testSingleEntityCRUD_EmNotCleared() {
    // Persist/*from w  w w.j  ava2s  .c  o  m*/
    final SampleEntity entity = new SampleEntity();
    entity.setKey(1);
    entity.setName("Amry");
    entity.setCity("Delhi");
    em.persist(entity);
    SampleEntity found = em.find(SampleEntity.class, 1);
    assertSampleEntity(found);

    Assert.assertTrue(em.contains(found));

    found.setName("Xamry");
    found.setCity("Noida");
    em.merge(found);

    SampleEntity foundAfterMerge = em.find(SampleEntity.class, 1);
    assertUpdatedSampleEntity(foundAfterMerge);
    em.flush();

    em.remove(foundAfterMerge);
    SampleEntity foundAfterDeletion = em.find(SampleEntity.class, 1);
    Assert.assertNull(foundAfterDeletion);
}