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

Source Link

Document

Asserts that an object isn't null.

Usage

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

@Test
public void shouldGetAConceptName() throws Exception {
    Object result = controller.retrieve(conceptUuid, nameUuid, request);
    Assert.assertNotNull(result);
    Assert.assertEquals("COUGH SYRUP", PropertyUtils.getProperty(result, "name"));
    Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo"));
    Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
}

From source file:eu.delving.sip.TestStorage.java

@Test
public void zipImport() throws StorageException, IOException {
    File storageDir = new File(Mockery.getTargetDirectory(), "storage");
    FileUtils.deleteQuietly(storageDir);
    FileSystemFetcher localFetcher = new FileSystemFetcher(true);
    SchemaRepository repo = new SchemaRepository(localFetcher);
    Storage storage = new StorageImpl(storageDir, repo, null);
    File zip = new File(getClass().getResource("/zip/ZipImport.xml.zip").getFile());
    final DataSet dataSet = storage.createDataSet("spek", "orgy");
    FileUtils.write(new File(dataSet.importedOutput().getParent(), "dataset_facts.txt"),
            "schemaVersions=ese_3.4.0\n");
    DataSetModel dataSetModel = new DataSetModel();
    dataSetModel.setDataSet(dataSet, "ese");
    Work.LongTermWork importer = new FileImporter(zip, dataSet, null);
    MockProgressListener importProgress = new MockProgressListener();
    importer.setProgressListener(importProgress);
    importer.run();//w w w. ja  v  a  2s  .c o  m
    Assert.assertNotNull(dataSet.openImportedInputStream());
    Assert.assertEquals("Alert list size for import wrong", 0, importProgress.getAlerts().size());
    FileUtils.write(new File(dataSet.importedOutput().getParent(), "hints.txt"),
            "recordCount=6\n" + "recordRootPath=/zip-entries/eadgrp/archdescgrp/dscgrp/ead\n"
                    + "uniqueElementPath=/zip-entries/eadgrp/archdescgrp/dscgrp/ead/eadheader/eadid\n");
    AnalysisParser parser = new AnalysisParser(dataSetModel, 60, new AnalysisParser.Listener() {
        @Override
        public void success(Stats stats) {
            try {
                dataSet.setStats(stats, false, null);
            } catch (StorageException e) {
                throw new RuntimeException(e);
            }
        }

        @Override
        public void failure(String message, Exception exception) {
            throw new RuntimeException(exception);
        }
    });
    parser.run();
    SourceConverter converter = new SourceConverter(dataSet, new Runnable() {
        @Override
        public void run() {
            Assert.assertEquals("Data set should still be in delimited state", DataSetState.DELIMITED,
                    dataSet.getState(null));
        }
    });
    MockProgressListener convertProgress = new MockProgressListener();
    converter.setProgressListener(convertProgress);
    // the conversion will fail because of a too-large identifier!
    converter.run();
    Assert.assertEquals("Alert list size for convert wrong", 1, convertProgress.getAlerts().size());
}

From source file:org.codehaus.grepo.query.hibernate.repository.HibernateRepositoryTest.java

@Test
public void testWithNamedQueryUsingNamedParams() {
    Assert.assertNotNull(repo.getByUsernameUsingNamedParams("username"));
}

From source file:repository.TerrainTest.java

@Test
public void creationLieuAvecTerrainTest() {
    Terrain terrain = new Terrain(NOM_TERRAIN, "pour test", 1, 1);

    terrainRepository.save(terrain);/*  w w  w  . j a  v  a 2  s .com*/
    Lieu lieu = new Lieu(1000, 1000, terrain);
    lieu.setTerrainId(terrain);
    lieuRepository.save(lieu);
    Assert.assertNotNull(lieu);
    assertThat("some text").isNotEmpty().startsWith("some").hasSize(9);
    assertEquals(String.format("La production d'eau aurait d etre 1 au lieu de %s.", terrain.getProdEau()), 1,
            terrain.getProdEau());
}

From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java

@Test
public void listBookmarksTest() {

    final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open");
    final List<InstaRecordBean> instaRecordBeans = client.listBookmarks(null, null, null);

    // [{"type":"meta"},{"type":"user","user_id":1615568,"username":"jinstapaper@gmail.com",
    // "subscription_is_active":"1"},
    // {"type":"bookmark","bookmark_id":184117327,"url":"http:\/\/toilettwit.info\/","title":"ToileTTwiT",
    // "description":"Adding Toilettwit","time":1310438674,"starred":"0","private_source":"","hash":"nHlrTfNc","progress":0,"progress_timestamp":0}
    // ,{"type":"bookmark","bookmark_id":182746673,"url":"http:\/\/blogs.oracle.com\/PavelBucek\/entry\/replacing_client_used_in_jersey","title":"Replacing client used in Jersey Test Framework (Pavel Bucek's weblog)","description":"","time":1310080684,"starred":"0","private_source":"","hash":"3FOA5RyF","progress":0,"progress_timestamp":0}]

    Assert.assertNotNull(instaRecordBeans);
}

From source file:it.geosolutions.geobatch.testsuite.FileBasedFlowManagerTestCase.java

@Test
public void testFSFlowManagerService() throws IOException, InterruptedException {
    // ////from   w  w  w  . j  a  v  a2s  .c o m
    //
    // get the FileBasedEventGeneratorService bean service from the context
    //
    // //
    Object o = context.getBean("fsFlowManagerService", FileBasedFlowManagerService.class);
    Assert.assertNotNull(o);
    Assert.assertTrue(o instanceof FileBasedFlowManagerService);

    final FileBasedFlowManagerService service = (FileBasedFlowManagerService) o;

    // //
    //
    // Create a fictitious EventGeneratorConfiguration configuration
    //
    // //
    //        final FileBasedEventGeneratorConfiguration eventGeneratorConfiguration = new FileBasedEventGeneratorConfiguration();
    //        eventGeneratorConfiguration.setId("id");
    //        eventGeneratorConfiguration.setName("name");
    //        eventGeneratorConfiguration.setDescription("description");
    //        eventGeneratorConfiguration.setOsType(OsType.OS_UNDEFINED);
    //        eventGeneratorConfiguration.setWorkingDirectory(TestData.file(this, ".").getAbsolutePath());
    //
    //        // //
    //        //
    //        // Create a fictitious EventGeneratorConfiguration configuration
    //        //
    //        // //
    //        final FileBasedEventConsumerConfiguration eventConsumerConfiguration = new FileBasedEventConsumerConfiguration();
    //        eventConsumerConfiguration.setId("fsEventConsumerConfiguration");
    //        eventConsumerConfiguration.setName("fsEventConsumerConfiguration");
    //        eventConsumerConfiguration.setDescription("fsEventConsumerConfiguration");
    //        eventConsumerConfiguration.setWorkingDirectory(TestData.file(this, ".").getAbsolutePath());
    //
    //        final FileEventRule rule = new FileEventRule();
    //        rule.setAcceptableNotifications(Arrays.asList(FileSystemEventType.FILE_ADDED));
    //        rule.setActualOccurrencies(1);
    //        rule.setId("tesRule");
    //        rule.setOptional(false);
    //        rule.setRegex(".*\\.txt");
    //        eventConsumerConfiguration.setRules(Arrays.asList(rule));
    // eventConsumerConfiguration.setActions(Arrays.asList(new
    // BaseAction<FileSystemEvent>() {
    //
    //
    // public FileSystemEvent process(
    // FileSystemEvent event) {
    // FileBasedFlowManagerTestCase.this.LOGGER.info(event.toString());
    // return event;
    // }});

    // flow configuration
    //        final FileBasedFlowConfiguration flowConfiguration = new FileBasedFlowConfiguration();
    //        flowConfiguration.setId("id");
    //        flowConfiguration.setName("name");
    //        flowConfiguration.setDescription("description");
    //        flowConfiguration.setWorkingDirectory(TestData.file(this, ".").getAbsolutePath());
    //        flowConfiguration.setEventConsumerConfiguration(eventConsumerConfiguration);
    //        flowConfiguration.setEventGeneratorConfiguration(eventGeneratorConfiguration);

    // //
    //
    // Check if we can create the needed EventGenerator and if so create it
    //
    // //
    //        final boolean result = service.canCreateFlowManager(flowConfiguration);
    //        Assert.assertTrue(result);
    //
    //        // create the event generator
    //        final FileBasedFlowManager eg = service.createFlowManager(flowConfiguration);
    //        Thread flowM = new Thread(eg);
    //        flowM.start();

    Thread.sleep(10000);

    //
    //
    final File file = TestData.temp(this, "test");
    // if(file.exists()) {
    synchronized (this) {
        this.wait(5000);
    }
    // Assert.assertTrue("unable to create test",this.caughtEvent);
    // }
    // else
    // Assert.assertTrue("unable to create test",false);

}

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

@Test
public void testGetChunkReturnsAppropriateChunk() {
    Location location = helpers.newLocation("world", 123, 321);

    ChunkData chunkIWant = helpers.newChunkData("player", new ArrayList<String>(), location);

    systemUnderTest.addChunk(chunkIWant);

    Assert.assertNotNull(systemUnderTest.getChunkAt(location));
}

From source file:org.codehaus.grepo.query.hibernate.generator.GeneratorRepositoryTest.java

@Test
public void testWithQueryDslQueryGenerator() {
    Assert.assertNotNull(repo.getWithQueryDslQueryGenerator("firstname"));
}

From source file:com.googlecode.t7mp.steps.resources.CopySetenvScripStepTest.java

@Test
public void testCopySetenvScriptStep() {
    String setenvScriptPath = getClass().getResource("/com/googlecode/t7mp/bin/setenv.sh").getPath();
    File t7mpDirectory = new File(setenvScriptPath).getParentFile().getParentFile();
    File confDirectory = new File(t7mpDirectory, "/conf/");
    Assert.assertNotNull(confDirectory);
    Assert.assertTrue(confDirectory.exists());
    Mockito.when(mojo.getTomcatConfigDirectory()).thenReturn(new File(t7mpDirectory, "/conf/"));
    Context context = new DefaultContext(mojo);
    Step step = new CopySetenvScriptStep();
    step.execute(context);/*from w  w  w  .jav a  2 s  .  co  m*/
    File binDirectory = new File(catalinaBaseDir, "/bin/");
    Assert.assertNotNull(binDirectory);
    Assert.assertTrue(binDirectory.exists());
    File copyiedSetenvScript = new File(binDirectory, "setenv.sh");

    Assert.assertNotNull(copyiedSetenvScript);
    Assert.assertTrue(copyiedSetenvScript.exists());
}

From source file:com.cloudant.sync.datastore.BasicDatastoreTestBase.java

BasicDocumentRevision[] createThreeDocuments() throws ConflictException {
    BasicDocumentRevision rev_1 = datastore.createDocument(bodyOne);
    validateNewlyCreatedDocument(rev_1);
    BasicDocumentRevision rev_2 = datastore.createDocument(bodyTwo);
    validateNewlyCreatedDocument(rev_2);
    BasicDocumentRevision rev_3 = datastore.createDocument(bodyTwo);
    validateNewlyCreatedDocument(rev_3);
    BasicDocumentRevision rev_4 = (BasicDocumentRevision) datastore.updateDocument(rev_3.getId(),
            rev_3.getRevision(), bodyOne);
    Assert.assertNotNull(rev_4);
    return new BasicDocumentRevision[] { rev_1, rev_2, rev_4 };
}