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.netxilia.spi.impl.formula.TestFindAndFilter.java

@Test
public void testFindValue() 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.assertEquals(new CellReference("test!A1"), ref1);

    // "200" is not equals to 200 !
    CellReference ref3 = operations.find(sheet, ref1, new Formula("=A1=200")).getNonBlocking();
    Assert.assertEquals(new CellReference("test!A3"), ref3);

    CellReference ref4 = operations.find(sheet, ref3, new Formula("=A1=200")).getNonBlocking();
    Assert.assertNull(ref4);
}

From source file:org.jasig.ssp.util.importer.job.BatchPartialUploadTest.java

@SuppressWarnings("unchecked")
@Test//from   w  ww  . jav  a  2  s. c o m
public void testDirectoryNoFiles() throws Exception {

    deleteDirectory(inputDirectoryPath);
    createDirectory(inputDirectoryPath);
    Assert.assertTrue(directoryExists(inputDirectoryPath));

    JobExecution jobExecution = jobLauncherTestUtils.launchJob();
    BatchStatus exitStatus = jobExecution.getStatus();

    Map<String, ReportEntry> report = (Map<String, ReportEntry>) jobExecution.getExecutionContext()
            .get("report");
    Assert.assertNull(report);

    Assert.assertEquals(BatchStatus.STOPPED, exitStatus);

    Assert.assertTrue(directoryExists(inputDirectoryPath));

}

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

@Test
public void saveReportGroup_shouldSaveReportGroup() throws Exception {
    final String groupName = "New Report Group";

    List<ReportGroup> reportGroups = reportsService.getReportGroups();
    Assert.assertEquals(1, reportGroups.size());
    Assert.assertNull(getReportGroup(groupName, reportGroups));

    ReportGroup reportGroup = new ReportGroup(groupName);
    reportGroup.setCreator(userService.getUsers().get(0));
    reportGroup.setDateCreated(new Date());
    reportsService.saveReportGroup(reportGroup);

    reportGroups = reportsService.getReportGroups();
    Assert.assertEquals(2, reportGroups.size());

    reportGroup = getReportGroup(groupName, reportGroups);
    Assert.assertNotNull(reportGroup);//from   w  w  w  . j  av  a2s  .com
    Assert.assertEquals(groupName, reportGroup.getName());
}

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

/**
 * https://github.com/couchbase/couchbase-lite-android/issues/301
 *///w  w  w  .  ja  va 2  s  .c  o  m
public void testPutDeletedDocument() throws CouchbaseLiteException {

    Document document = database.createDocument();
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("foo", "foo");
    properties.put("bar", Boolean.FALSE);
    document.putProperties(properties);
    Assert.assertNotNull(document.getCurrentRevision());
    String docId = document.getId();

    properties.put("_rev", document.getCurrentRevisionId());
    properties.put("_deleted", true);
    properties.put("mykey", "myval");
    SavedRevision newRev = document.putProperties(properties);
    newRev.loadProperties();
    assertTrue(newRev.getProperties().containsKey("mykey"));

    Assert.assertTrue(document.isDeleted());
    Document fetchedDoc = database.getExistingDocument(docId);
    Assert.assertNull(fetchedDoc);

    // query all docs and make sure we don't see that document
    database.getAllDocs(new QueryOptions());
    Query queryAllDocs = database.createAllDocumentsQuery();
    QueryEnumerator queryEnumerator = queryAllDocs.run();
    for (Iterator<QueryRow> it = queryEnumerator; it.hasNext();) {
        QueryRow row = it.next();
        Assert.assertFalse(row.getDocument().getId().equals(docId));
    }
}

From source file:com.logsniffer.model.support.LineInputStreamTest.java

@Test
public void testWindowsNL() throws IOException {
    FileLog flog = new FileLog(writeString2Tmp("line1\r\nline2", "UTF-8"));
    DirectFileLogAccess logAccess = new DirectFileLogAccess(flog);
    LineInputStream log = new LineInputStream(logAccess, logAccess.getInputStream(null), "UTF-8");
    LogPointer start = log.getPointer();
    Assert.assertEquals("line1", log.readNextLine());
    Assert.assertEquals("line1\r\n".getBytes("UTF-8").length,
            logAccess.getDifference(start, log.getPointer()));
    Assert.assertEquals(false, log.getPointer().isEOF());
    Assert.assertEquals("line2", log.readNextLine());
    log.close();//from  w  w w.  ja v  a  2s  . c  o  m

    log = new LineInputStream(logAccess,
            logAccess.getInputStream(logAccess.createRelative(null, "line1\r\n".getBytes("UTF-8").length)),
            "UTF-8");
    Assert.assertEquals("line2", log.readNextLine());
    Assert.assertNull(log.readNextLine());
    Assert.assertEquals(true, log.getPointer().isEOF());
    log.close();

}

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

@Test
public void deleteSettingGroup_shouldDeleteSettingGroupWithGivenName() throws Exception {
    SettingGroup settingGroup = getSettingGroup("General");
    Assert.assertNotNull(settingGroup);/* w w w.java 2 s  . c om*/

    settingService.deleteSettingGroup(settingGroup);

    Assert.assertNull(getSettingGroup("General"));
}

From source file:com.amazonaws.http.AmazonHttpClientRequestTimeoutTest.java

@Test(timeout = 10 * 1000)
public void testRequestTimeoutDisabled() {
    ProblematicServer server = new ProblematicServer(ProblematicServer.ServerIssue.UNRESPONSIVE);
    server.startServer();/*from   w w  w  .  j a v a 2s. c  o m*/

    String localhostEndpoint = "http://localhost:" + server.getPort();
    Request<?> request = new EmptyHttpRequest(localhostEndpoint, HttpMethodName.GET);

    AmazonHttpClient httpClient = new AmazonHttpClient(
            new ClientConfiguration().withSocketTimeout(1 * 1000).withRequestTimeout(0).withMaxErrorRetry(0));

    try {
        httpClient.execute(request, new NullResponseHandler(), new NullErrorResponseHandler(),
                new ExecutionContext());
        Assert.fail("Client-side socket read timeout is expected!");
    } catch (AmazonClientException e) {
        Assert.assertTrue(e.getCause() instanceof SocketTimeoutException);
        /* The internal request timer should not have been instantiated. */
        ScheduledThreadPoolExecutor httpRequestTimer = httpClient.getHttpRequestTimer().getExecutor();
        Assert.assertNull(httpRequestTimer);
    }

    server.stopServer();
    httpClient.shutdown();
}

From source file:net.idea.opentox.cli.test.DatasetClientTest.java

@Override
public void testCreate() throws Exception {
    //in case the TEST_SERVER uses HTTP BASIC
    otclient.setHTTPBasicCredentials("localhost", 8080, "admin", "changeit");

    DatasetClient<POLICY_RULE> cli = getOTClient();
    URL url = getClass().getClassLoader().getResource("net/idea/opentox/cli/test/sdf/1000-90-4.sdf");
    File fileToImport = new File(url.getFile());
    Assert.assertTrue(fileToImport.exists());
    Dataset dataset = new Dataset();
    dataset.getMetadata().setTitle("Test dataset");
    dataset.getMetadata().setSeeAlso("Test see also uri");
    dataset.getMetadata()//from   www.j a va 2  s  .c  o m
            .setRights(new Rights("CC-BY-SA", "http://creativecommons.org/licenses/by-sa/2.0/", _type.license));
    dataset.setInputData(new InputData(fileToImport, DatasetClient._MATCH.InChI));
    RemoteTask task = cli.postAsync(dataset,
            new Identifier(String.format("%s%s", TEST_SERVER, Resources.dataset)));
    task.waitUntilCompleted(1000);
    //verify if ok
    Assert.assertEquals(HttpStatus.SC_OK, task.getStatus());
    Assert.assertNull(task.getError());
    List<Dataset> theDataset = cli.getMetadata(task.getResult());
    Assert.assertEquals(1, theDataset.size());
    Assert.assertEquals(dataset.getMetadata().getTitle(), theDataset.get(0).getMetadata().getTitle());
    Assert.assertEquals(dataset.getMetadata().getSeeAlso(), theDataset.get(0).getMetadata().getSeeAlso());
    Assert.assertEquals(task.getResult(), theDataset.get(0).getResourceIdentifier());

    CompoundClient<POLICY_RULE> ccli = otclient.getCompoundClient();
    List<Compound> compounds = cli.getCompounds(theDataset.get(0), ccli);
    Assert.assertNotNull(compounds);
    for (Compound compound : compounds) {
        System.out.println(compound);
    }

    //finally delete the dataset
    cli.delete(theDataset.get(0));
}

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

/**
 * @See {@link ConceptDescriptionResource#getByUniqueId(String)}
 * @throws Exception// w w w. j  a v a 2s  .  c om
 */
@Test
public void shouldGetAConceptDescription() throws Exception {
    Object result = controller.retrieve(conceptUuid, descriptionUuid, request);
    Assert.assertNotNull(result);
    Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
    Assert.assertEquals("Affirmative", PropertyUtils.getProperty(result, "description"));
    Assert.assertEquals("en", PropertyUtils.getProperty(result, "locale"));
    Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo"));
}

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

@Test
public void searchUserByToken() {
    User u = dao.readUser(TOKEN_PRESENT);
    Assert.assertNotNull(u);
    u = dao.readUser(TOKEN_NOT_PRESENT);
    Assert.assertNull(u);
}