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(String message, Object object) 

Source Link

Document

Asserts that an object isn't null.

Usage

From source file:org.apache.synapse.transport.passthru.config.BaseConfigurationTest.java

@Test
public void testGetIOBufferSize() throws Exception {
    Assert.assertNotNull("IO Buffer hasn't been initialized.", baseConfiguration.getIOBufferSize());
    Assert.assertNotSame("IO buffer size hasn't been taken from passthru-http.properties file",
            conf.getIOBufferSize(), DEFAULT_IO_BUFFER_SIZE);
}

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

@Test
public void testFindUserByPhoneNo() throws Exception {
    User user = userService.findUserByPhoneNo("0768198075");
    Assert.assertNotNull("dagmar's users is there", user);
    Assert.assertEquals("her username is user", "user", user.getName());

}

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

public void testReopen() throws Exception {
    if (!isSQLiteDB())
        return;//from   ww  w .jav a 2s.c o m

    byte[] item = "this is an item".getBytes("UTF8");
    BlobKey key = new BlobKey();
    Assert.assertTrue(store.storeBlob(item, key));

    BlobStore store2 = new BlobStore(manager.getContext(), store.getPath(), store.getEncryptionKey(), true);
    Assert.assertNotNull("Couldn't re-open store", store2);

    byte[] readItem = store2.blobForKey(key);
    Assert.assertTrue(Arrays.equals(readItem, item));

    readItem = store.blobForKey(key);
    Assert.assertTrue(Arrays.equals(readItem, item));
    verifyRawBlob(key, item);
}

From source file:org.deviceconnect.android.profile.restful.test.NormalConnectProfileTestCase.java

/**
 * WiFi?.//from  ww w.  j  a  v a  2 s.  c  o  m
 * <pre>
 * ?HTTP
 * Method: PUT
 * Path: /connect/wifi?deviceid=xxxx
 * </pre>
 * <pre>
 * ??
 * result?0???????
 * </pre>
 */
public void testPutWifi() {
    StringBuilder builder = new StringBuilder();
    builder.append(DCONNECT_MANAGER_URI);
    builder.append("/" + ConnectProfileConstants.PROFILE_NAME);
    builder.append("/" + ConnectProfileConstants.ATTRIBUTE_WIFI);
    builder.append("?");
    builder.append(DConnectProfileConstants.PARAM_DEVICE_ID + "=" + getDeviceId());
    builder.append("&");
    builder.append(AuthorizationProfileConstants.PARAM_ACCESS_TOKEN + "=" + getAccessToken());
    try {
        HttpUriRequest request = new HttpPut(builder.toString());
        JSONObject root = sendRequest(request);
        Assert.assertNotNull("root is null.", root);
        Assert.assertEquals(DConnectMessage.RESULT_OK, root.getInt(DConnectMessage.EXTRA_RESULT));
    } catch (JSONException e) {
        fail("Exception in JSONObject." + e.getMessage());
    }
}

From source file:org.esco.portlet.changeetab.service.impl.CachingEtablissementServiceTest.java

@Test
public void testRetrieveOneExistingEtab() throws Exception {
    final Collection<String> uais = new ArrayList<String>();
    uais.add(CachingEtablissementServiceTest.UAI_2);

    final Map<String, Etablissement> etabs = this.service.retrieveEtablissementsByCodes(uais);

    Assert.assertNotNull("Should return an empty collection !", etabs);
    Assert.assertEquals("Should return only one etab !", 1, etabs.size());
    Assert.assertTrue("Bad etab returned !", etabs.containsValue(CachingEtablissementServiceTest.ETAB_2));
}

From source file:com.nextep.designer.unittest.synch.SynchronizationTest.java

@Override
protected void runTest() throws Throwable {
    final ISynchronizationService synchService = SynchPlugin.getService(ISynchronizationService.class);

    // This listener registers the synchronization result
    synchService.addSynchronizationListener(new ISynchronizationListener() {

        @Override//from   ww w .  j a va2 s . c o  m
        public void scopeChanged(ComparisonScope scope) {

        }

        @Override
        public void newSynchronization(ISynchronizationResult synchronizationResult) {
            synchResult = synchronizationResult;
        }
    });

    // Synchronizing workspace
    final IConnection targetConnection = buildConnection();
    final IWorkspace workspace = VCSPlugin.getViewService().getCurrentWorkspace();
    synchService.synchronize(workspace, targetConnection, null);
    // We should have a result
    Assert.assertNotNull("Synchronization didn't provide a result", synchResult); //$NON-NLS-1$
    // Now we will submit the result to our database
    final ISQLScript script = synchResult.getGeneratedScript();
    log.info("Submitting following SQL :\n" + script.getSql()); //$NON-NLS-1$
    SubmitionManager.submit(synchResult.getConnection(), script, synchResult.getGenerationResult(),
            new NullProgressMonitor());
    // Now we will do a synchronization again
    synchResult = null;
    synchService.synchronize(workspace, targetConnection, null);
    checkNoDifference(synchResult);

    // Data synchronization
    final IVersionable<?> dataSetV = TestHelper.getVersionableByName("DEPARTMENTS",
            IElementType.getInstance(IDataSet.TYPE_ID), TestHelper.getFirstContainer());
    final IDataSet dataSet = (IDataSet) dataSetV.getVersionnedObject().getModel();
    synchResult = null;
    synchService.synchronizeData(targetConnection, null, VersionHelper.getVersionable(dataSet.getTable()));
    Assert.assertNotNull("Data synchronization didn't provide a result", synchResult); //$NON-NLS-1$
    synchService.buildScript(synchResult, null);
    Assert.assertNotNull("Data script has not been built after explicit build",
            synchResult.getGeneratedScript());

    // Now we will submit the result to our database
    final ISQLScript dataScript = synchResult.getGeneratedScript();
    log.info("Submitting following data SQL script :\n" + dataScript.getSql()); //$NON-NLS-1$
    SubmitionManager.submit(synchResult.getConnection(), dataScript, synchResult.getGenerationResult(),
            new NullProgressMonitor());

    // Synchronizing again to check that everything is synched
    synchService.synchronizeData(targetConnection, null, VersionHelper.getVersionable(dataSet.getTable()));
    checkNoDifference(synchResult);
}

From source file:org.deviceconnect.android.profile.restful.test.NormalFileDescriptorProfileTestCase.java

/**
 * ??.//from ww  w  .  java 2  s  .c om
 * <pre>
 * ?HTTP
 * Method: PUT
 * Path: /file_descriptor/close?deviceid=xxxx&mediaid=xxxx
 * </pre>
 * <pre>
 * ??
 * result?0???????
 * </pre>
 */
public void testClose() {
    StringBuilder builder = new StringBuilder();
    builder.append(DCONNECT_MANAGER_URI);
    builder.append("/" + FileDescriptorProfileConstants.PROFILE_NAME);
    builder.append("/" + FileDescriptorProfileConstants.ATTRIBUTE_CLOSE);
    builder.append("?");
    builder.append(DConnectProfileConstants.PARAM_DEVICE_ID + "=" + getDeviceId());
    builder.append("&");
    builder.append(FileDescriptorProfileConstants.PARAM_PATH + "=test.txt");
    builder.append("&");
    builder.append(AuthorizationProfileConstants.PARAM_ACCESS_TOKEN + "=" + getAccessToken());
    try {
        HttpUriRequest request = new HttpPut(builder.toString());
        JSONObject root = sendRequest(request);
        Assert.assertNotNull("root is null.", root);
        Assert.assertEquals(DConnectMessage.RESULT_OK, root.getInt(DConnectMessage.EXTRA_RESULT));
    } catch (JSONException e) {
        fail("Exception in JSONObject." + e.getMessage());
    }
}

From source file:org.apache.synapse.transport.passthru.config.BaseConfigurationTest.java

@Test
public void testGetConfigurationContext() throws Exception {
    Assert.assertNotNull("Configuration context hasn't been initialized.",
            baseConfiguration.getConfigurationContext());
}

From source file:com.mnxfst.testing.server.cfg.TestPTestServerConfigurationParser.java

@Test
public void testEvaluateStringWithHostnameExpression()
        throws ParserConfigurationException, XPathExpressionException, SAXException, IOException {
    PTestServerConfigurationParser p = new PTestServerConfigurationParser();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
            new ByteArrayInputStream("<ptest-server><hostname>testhost</hostname></ptest-server>".getBytes()));
    String result = p.evaluateString(p.xpathExpressionHostname, document);
    Assert.assertNotNull("The result must not be null", result);
    Assert.assertFalse("The result must not be empty", result.isEmpty());
    Assert.assertEquals("The result must be 'testhost'", "testhost", result);
}

From source file:org.apache.synapse.transport.passthru.config.SourceConfigurationTest.java

@Test
public void testBuild() throws Exception {
    Assert.assertNotNull("Building base configuration isn't successful.", sourceConfiguration);
    Assert.assertNotNull("Worker pool hasn't been initialized.", sourceConfiguration.getWorkerPool());
    Assert.assertNotSame("Worker thread count hasn't been taken from passthru-http.properties file",
            passThroughConfiguration.getWorkerPoolCoreSize(), DEFAULT_WORKER_POOL_SIZE_CORE);
}