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:eagle.storage.jdbc.TestJdbcStorage.java

public void testReadBySimpleQuery() throws QueryCompileException, IOException {
    RawQuery rawQuery = new RawQuery();
    rawQuery.setQuery("TestTimeSeriesAPIEntity[]{*}");
    rawQuery.setStartTime("2014-01-06 01:40:02");
    rawQuery.setEndTime("2016-01-06 01:40:02");
    rawQuery.setPageSize(1000);//from   w  w  w. jav  a 2s . c o  m
    CompiledQuery query = new CompiledQuery(rawQuery);
    QueryResult<TestTimeSeriesAPIEntity> result = storage.query(query, entityDefinition);
    Assert.assertNotNull(result);
}

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

@Test
public void saveMobileMenuText_shouldSaveMobileMenuTextList() throws Exception {
    final String textName = "Exit";

    List<MobileMenuText> textList = utilityService.getMobileMenuText("en");
    Assert.assertEquals(1, textList.size());
    Assert.assertNull(getMobileMenuText(textName, textList));

    MobileMenuText mobileMenuText = new MobileMenuText();
    mobileMenuText.setMenuText(textName);
    mobileMenuText.setLocaleKey("en");
    mobileMenuText.setMenuId((short) 2);
    mobileMenuText.setCreator(userService.getUsers().get(0));
    mobileMenuText.setDateCreated(new Date());

    textList = new ArrayList<MobileMenuText>();
    textList.add(mobileMenuText);/*from w  w  w .  ja v a 2  s. co m*/

    utilityService.saveMobileMenuText(textList);

    textList = utilityService.getMobileMenuText("en");
    Assert.assertEquals(2, textList.size());
    Assert.assertNotNull(getMobileMenuText(textName, textList));
}

From source file:ml.shifu.shifu.core.dvarsel.wrapper.WrapperWorkerConductorTest.java

@Test
public void testWrapperConductor() throws IOException {
    ModelConfig modelConfig = CommonUtils.loadModelConfig(
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ModelConfig.json",
            RawSourceData.SourceType.LOCAL);
    List<ColumnConfig> columnConfigList = CommonUtils.loadColumnConfigList(
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ColumnConfig.json",
            RawSourceData.SourceType.LOCAL);

    WrapperWorkerConductor wrapper = new WrapperWorkerConductor(modelConfig, columnConfigList);
    TrainingDataSet trainingDataSet = genTrainingDataSet(modelConfig, columnConfigList);
    wrapper.retainData(trainingDataSet);

    List<Integer> columnIdList = new ArrayList<Integer>();
    for (int i = 2; i < 30; i++) {
        columnIdList.add(i);/*w  ww  .j  ava  2s .co  m*/
    }

    List<CandidateSeed> seedList = new ArrayList<CandidateSeed>();
    for (int i = 0; i < 10; i++) {
        seedList.add(new CandidateSeed(0, columnIdList.subList(i + 1, i + 7)));
    }
    wrapper.consumeMasterResult(new VarSelMasterResult(seedList));
    VarSelWorkerResult workerResult = wrapper.generateVarSelResult();

    Assert.assertNotNull(workerResult);
    Assert.assertTrue(workerResult.getSeedPerfList().size() > 0);
}

From source file:edu.uci.ics.jung.io.TestGraphMLReader.java

public void testLoad() throws IOException {
    String testFilename = "toy_graph.ml";

    Graph<Number, Number> graph = loadGraph(testFilename);

    Assert.assertEquals(graph.getVertexCount(), 3);
    Assert.assertEquals(graph.getEdgeCount(), 3);

    BidiMap<Number, String> vertex_ids = gmlreader.getVertexIDs();

    Number joe = vertex_ids.getKey("1");
    Number bob = vertex_ids.getKey("2");
    Number sue = vertex_ids.getKey("3");

    Assert.assertNotNull(joe);
    Assert.assertNotNull(bob);/*from w  ww.  j  a  v  a2  s.  c om*/
    Assert.assertNotNull(sue);

    Map<String, GraphMLMetadata<Number>> vertex_metadata = gmlreader.getVertexMetadata();
    Transformer<Number, String> name = vertex_metadata.get("name").transformer;
    Assert.assertEquals(name.transform(joe), "Joe");
    Assert.assertEquals(name.transform(bob), "Bob");
    Assert.assertEquals(name.transform(sue), "Sue");

    Assert.assertTrue(graph.isPredecessor(joe, bob));
    Assert.assertTrue(graph.isPredecessor(bob, joe));
    Assert.assertTrue(graph.isPredecessor(sue, joe));
    Assert.assertFalse(graph.isPredecessor(joe, sue));
    Assert.assertFalse(graph.isPredecessor(sue, bob));
    Assert.assertFalse(graph.isPredecessor(bob, sue));

    File testFile = new File(testFilename);
    testFile.delete();
}

From source file:com.taobao.ad.jpa.test.UUserTest.java

@Test
public void testFindUUsers() {
    UUserDO u = new UUserDO();
    Assert.assertNotNull(userBO.findUUsers(u));
}

From source file:com.kurento.kmf.media.JackVaderFilterTest.java

/**
 * Test if a {@link JackVaderFilter} can be created in the KMS. The filter
 * is pipelined with a {@link PlayerEndpoint}, which feeds video to the
 * filter. This test depends on the correct behaviour of the player and its
 * events./*w ww .j a  va 2s.co m*/
 * 
 * @throws InterruptedException
 */
@Test
public void testJackVaderFilter() throws InterruptedException {
    PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_SMALL).build();
    player.connect(jackVader);

    final BlockingQueue<EndOfStreamEvent> events = new ArrayBlockingQueue<EndOfStreamEvent>(1);
    player.addEndOfStreamListener(new MediaEventListener<EndOfStreamEvent>() {

        @Override
        public void onEvent(EndOfStreamEvent event) {
            events.add(event);
        }
    });

    player.play();

    Assert.assertNotNull(events.poll(10, SECONDS));

    player.stop();
    player.release();
}

From source file:com.abiquo.appliancemanager.ApplianceManagerAsserts.java

public void ovfStatus(final String ovfId, final TemplateStatusEnumType expectedStatus)
        throws AMClientException {

    TemplateStateDto prevStatus = stub.getTemplateStatus(idEnterprise, ovfId);

    Assert.assertEquals(expectedStatus, prevStatus.getStatus());
    Assert.assertEquals(ovfId, prevStatus.getOvfId());

    if (expectedStatus == TemplateStatusEnumType.ERROR) {
        Assert.assertNotNull(prevStatus.getErrorCause());
    } else {//from  w w  w. ja v a  2  s.  c om
        Assert.assertNull(prevStatus.getErrorCause());
    }

}

From source file:ru.codemine.pos.service.StoreServiceTest.java

@Test
public void testStoreService() {
    log.info("---  ? StoreService---");

    try {/*ww w .ja va 2  s  .c  o m*/
        storeService.create(store);
    } catch (DuplicateStoreDataException ex) {
        ex.printStackTrace();
    }

    log.info("  ?  ...");
    Store s1 = storeService.getByName("TheTestStore");
    Store unproxedS1 = storeService.unproxyStocks(s1);
    Assert.assertNotNull(unproxedS1);
    Assert.assertTrue(unproxedS1.getStocks().get(p1) == 1);
    log.info("...ok");

    log.info(" ? ? ?  ...");
    store.getStocks().put(p3, 10);
    try {
        storeService.update(store);
    } catch (DuplicateStoreDataException ex) {
        ex.printStackTrace();
    }
    Store s2 = storeService.getByName("TheTestStore");
    Store unproxedS2 = storeService.unproxyStocks(s2);
    Assert.assertNotNull(unproxedS2);
    Assert.assertTrue(unproxedS2.getStocks().get(p3) == 10);
    log.info("...ok");

}

From source file:com.linkedin.pinot.core.segment.index.SegmentMetadataImplTest.java

@Test
public void testToJson() throws IOException, ConfigurationException, JSONException {
    SegmentMetadataImpl metadata = new SegmentMetadataImpl(segmentDirectory);
    Assert.assertNotNull(metadata);
    JSONObject jsonMeta = metadata.toJson(null);
    Assert.assertEquals(jsonMeta.get("segmentName"), metadata.getName());
    Assert.assertEquals(jsonMeta.getLong("crc"), Long.valueOf(metadata.getCrc()).longValue());
    Assert.assertEquals(jsonMeta.getString("paddingCharacter"), String.valueOf(metadata.getPaddingCharacter()));
    Assert.assertEquals(jsonMeta.get("creatorName"), metadata.getCreatorName());
    Assert.assertEquals(jsonMeta.get("creationTimeMillis"), metadata.getIndexCreationTime());
    Assert.assertEquals(jsonMeta.get("startTimeMillis"), metadata.getTimeInterval().getStartMillis());
    Assert.assertEquals(jsonMeta.get("endTimeMillis"), metadata.getTimeInterval().getEndMillis());
    Assert.assertEquals(jsonMeta.get("pushTimeMillis"), metadata.getPushTime());
    Assert.assertEquals(jsonMeta.get("refreshTimeMillis"), metadata.getPushTime());
    JSONArray jsonColumnList = jsonMeta.getJSONArray("columns");
    Assert.assertEquals(jsonColumnList.length(), metadata.getAllColumns().size());
    for (int i = 0; i < jsonColumnList.length(); i++) {
        JSONObject jsonColumn = jsonColumnList.getJSONObject(i);
        ColumnMetadata colMeta = metadata.getColumnMetadataFor(jsonColumn.getString("columnName"));
        Assert.assertEquals(jsonColumn.get("cardinality"), colMeta.getCardinality());
        Assert.assertEquals(jsonColumn.get("totalRawDocs"), colMeta.getTotalRawDocs());
        Assert.assertEquals(jsonColumn.get("bitsPerElement"), colMeta.getBitsPerElement());
        Assert.assertEquals(jsonColumn.getBoolean("sorted"), colMeta.isSorted());
        Assert.assertEquals(jsonColumn.get("totalAggDocs"), colMeta.getTotalAggDocs());
        Assert.assertEquals(jsonColumn.get("containsNulls"), colMeta.hasNulls());
        Assert.assertEquals(jsonColumn.getBoolean("hasDictionary"), colMeta.hasDictionary());
    }/*from w w  w. j ava2 s .  c o m*/

}

From source file:net.i2cat.netconf.test.TransportContentparserTest.java

@Test
public void parseReplyErrorTest() throws IOException, SAXException {

    String messageId = "1";
    String message = "Malformed XML!!!";

    for (ErrorType type : ErrorType.values()) {
        for (ErrorTag tag : ErrorTag.values()) {
            for (ErrorSeverity severity : ErrorSeverity.values()) {

                String replyMsg = buildErrorRepy(messageId, type.toString(), tag.toString(),
                        severity.toString(), message);

                parseMessage(replyMsg);//w  w  w. j  av a 2 s  .c  om

                Reply reply = (Reply) queue.consumeById(messageId);
                Assert.assertNotNull(reply);
                Assert.assertTrue(reply.containsErrors());

                Error error = reply.getErrors().get(0);
                Assert.assertEquals(severity, error.getSeverity());
                Assert.assertEquals(type, error.getType());
                Assert.assertEquals(tag, error.getTag());
                Assert.assertEquals(message, error.getMessage());
            }
        }
    }
}