Example usage for junit.framework Assert assertFalse

List of usage examples for junit.framework Assert assertFalse

Introduction

In this page you can find the example usage for junit.framework Assert assertFalse.

Prototype

static public void assertFalse(boolean condition) 

Source Link

Document

Asserts that a condition is false.

Usage

From source file:com.ebay.cloud.cms.query.service.QueryPaginationTest.java

@Test
public void testQueryIterSkip03_hint() {
    String query = "ApplicationService.services[@name=~\"srp.*\"].runsOn";
    raptorContext.setLimits(new int[] { 0, 0 });
    raptorContext.setSkips(new int[] { 0, 10 });
    raptorContext.setHint(0);/*from  www. j a  v  a2 s.com*/
    IQueryResult result = queryService.query(query, raptorContext);
    Assert.assertFalse(result.hasMoreResults());
    Assert.assertEquals(0, result.getEntities().size());
}

From source file:org.alfresco.mobile.android.test.api.services.ActivityStreamServiceTest.java

/**
 * All Tests forActivityStreamService public methods which create an error.
 * /*ww w. jav a  2 s.  c o m*/
 * @Requirement 3F1, 5F1, 5F2, 6F1, 6F2
 */
public void testActivityServiceMethodsError() {
    try {
        // ///////////////////////////////////////////////////////////////////////////
        // Method getActivityStream()
        // ///////////////////////////////////////////////////////////////////////////
        try {
            Assert.assertNotNull(activityStreamService.getActivityStream((String) null));
            Assert.fail();
        } catch (IllegalArgumentException e) {
            Assert.assertTrue(true);
        }

        if (!isOnPremise()) {
            try {
                activityStreamService.getSiteActivityStream("adm1n");
            } catch (AlfrescoServiceException e) {
                // Nothing special
            }
        } else {
            Assert.assertTrue(activityStreamService.getSiteActivityStream("adm1n").isEmpty());
        }

        // ///////////////////////////////////////////////////////////////////////////
        // Method getSiteActivityStream()
        // ///////////////////////////////////////////////////////////////////////////
        try {
            Assert.assertNotNull(activityStreamService.getSiteActivityStream((String) null));
            Assert.fail();
        } catch (IllegalArgumentException e) {
            Assert.assertTrue(true);
        }

        // Check Error activity
        if (!isOnPremise()) {
            try {
                activityStreamService.getSiteActivityStream("bestsite").isEmpty();
            } catch (AlfrescoServiceException e) {
                // Nothing special
            }
        } else {
            Assert.assertTrue(activityStreamService.getSiteActivityStream("bestsite").isEmpty());
        }

        AlfrescoSession session = createSession(CONSUMER, CONSUMER_PASSWORD, null);
        if (session != null) {
            if (!isOnPremise()) {
                try {
                    Assert.assertFalse(session.getServiceRegistry().getActivityStreamService()
                            .getSiteActivityStream("privatesite").isEmpty());
                } catch (AlfrescoServiceException e) {
                    // Nothing special
                }
            } else {
                // @since site service management it's not null.
                Assert.assertTrue(session.getServiceRegistry().getActivityStreamService()
                        .getSiteActivityStream("privatesite").isEmpty());
            }

            Assert.assertTrue(session.getServiceRegistry().getActivityStreamService()
                    .getSiteActivityStream("moderatedsite").isEmpty());
        }
        checkSession(session);
    } catch (Exception e) {
        Log.e(TAG, "Error during Activity Tests");
        Log.e("TAG", Log.getStackTraceString(e));
    }
}

From source file:com.linkedin.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManagerTest.java

@Test
public void testCommitAfterHold() throws Exception {
    FakeLLRealtimeSegmentDataManager segmentDataManager = createFakeSegmentManager();
    LLRealtimeSegmentDataManager.PartitionConsumer consumer = segmentDataManager.createPartitionConsumer();
    final long endOffset = _startOffset + 500;
    // We should consume initially...
    segmentDataManager._consumeOffsets.add(endOffset);
    final SegmentCompletionProtocol.Response holdResponse = new SegmentCompletionProtocol.Response(
            new SegmentCompletionProtocol.Response.Params().withOffset(endOffset)
                    .withStatus(SegmentCompletionProtocol.ControllerResponseStatus.HOLD));
    final SegmentCompletionProtocol.Response commitResponse = new SegmentCompletionProtocol.Response(
            new SegmentCompletionProtocol.Response.Params().withOffset(endOffset)
                    .withStatus(SegmentCompletionProtocol.ControllerResponseStatus.COMMIT));
    // And then never consume as long as we get a hold response, 100 times.
    segmentDataManager._responses.add(holdResponse);
    segmentDataManager._responses.add(commitResponse);

    consumer.run();/*from w  w w. j  ava2  s  .co m*/

    Assert.assertTrue(segmentDataManager._responses.isEmpty());
    Assert.assertTrue(segmentDataManager._consumeOffsets.isEmpty());
    Assert.assertTrue(segmentDataManager._buildSegmentCalled);
    Assert.assertFalse(segmentDataManager._buildAndReplaceCalled);
    Assert.assertFalse(segmentDataManager._downloadAndReplaceCalled);
    Assert.assertTrue(segmentDataManager._commitSegmentCalled);
    Assert.assertEquals(segmentDataManager._state.get(segmentDataManager),
            LLRealtimeSegmentDataManager.State.COMMITTED);
}

From source file:de.clusteval.data.goldstandard.TestGoldStandardConfig.java

/**
 * Test method for//  ww w.j a va2s.  c o  m
 * {@link data.goldstandard.GoldStandardConfig#notify(utils.RepositoryEvent)}
 * .
 * 
 * @throws GoldStandardNotFoundException
 * @throws NoRepositoryFoundException
 * @throws IOException
 * @throws GoldStandardConfigurationException
 * @throws RegisterException
 * @throws UnknownRunDataStatisticException
 * @throws UnknownRunStatisticException
 * @throws UnknownDataStatisticException
 * @throws NoOptimizableProgramParameterException
 * @throws UnknownParameterOptimizationMethodException
 * @throws IncompatibleParameterOptimizationMethodException
 * @throws IncompatibleDataSetConfigPreprocessorException
 * @throws UnknownDataPreprocessorException
 * @throws UnknownDataSetTypeException
 * @throws UnknownDistanceMeasureException
 * @throws UnknownRProgramException
 * @throws UnknownProgramTypeException
 * @throws UnknownProgramParameterException
 * @throws InvalidOptimizationParameterException
 * @throws UnknownRunResultFormatException
 * @throws IncompatibleContextException
 * @throws RunException
 * @throws UnknownClusteringQualityMeasureException
 * @throws UnknownParameterType
 * @throws UnknownContextException
 * @throws ConfigurationException
 * @throws NumberFormatException
 * @throws DataConfigNotFoundException
 * @throws DataConfigurationException
 * @throws NoDataSetException
 * @throws DataSetConfigNotFoundException
 * @throws DataSetNotFoundException
 * @throws DataSetConfigurationException
 * @throws UnknownDataSetFormatException
 */
@Test
public void testNotifyRepositoryEvent() throws IOException, NoRepositoryFoundException,
        GoldStandardNotFoundException, GoldStandardConfigurationException, GoldStandardConfigNotFoundException,
        RegisterException, UnknownDataSetFormatException, DataSetConfigurationException,
        DataSetNotFoundException, DataSetConfigNotFoundException, NoDataSetException,
        DataConfigurationException, DataConfigNotFoundException, NumberFormatException, ConfigurationException,
        UnknownContextException, UnknownParameterType, UnknownClusteringQualityMeasureException, RunException,
        IncompatibleContextException, UnknownRunResultFormatException, InvalidOptimizationParameterException,
        UnknownProgramParameterException, UnknownProgramTypeException, UnknownRProgramException,
        UnknownDistanceMeasureException, UnknownDataSetTypeException, UnknownDataPreprocessorException,
        IncompatibleDataSetConfigPreprocessorException, IncompatibleParameterOptimizationMethodException,
        UnknownParameterOptimizationMethodException, NoOptimizableProgramParameterException,
        UnknownDataStatisticException, UnknownRunStatisticException, UnknownRunDataStatisticException {

    /*
     * REPLACE
     */

    /*
     * First check, whether listeners of goldstandardconfigs are notified
     * correctly when the goldstandardconfig is replaced
     */
    GoldStandardConfig gsConfig = Parser.parseFromFile(GoldStandardConfig.class,
            new File("testCaseRepository/data/goldstandards/configs/DS1_1.gsconfig").getAbsoluteFile());
    StubRepositoryObject child = new StubRepositoryObject(getRepository(), false, System.currentTimeMillis(),
            new File("testCaseRepository/Bla"));
    gsConfig.addListener(child);

    GoldStandardConfig gsConfig2 = new GoldStandardConfig(gsConfig);

    gsConfig.notify(new RepositoryReplaceEvent(gsConfig, gsConfig2));
    Assert.assertTrue(child.notified);

    /*
     * Now check, whether goldstandard configs update their references
     * correctly, when their goldstandard is replaced
     */
    GoldStandard gs = gsConfig.getGoldstandard();
    GoldStandard gs2 = new GoldStandard(gs);

    gsConfig.notify(new RepositoryReplaceEvent(gs, gs2));

    Assert.assertFalse(gsConfig.getGoldstandard() == gs);
    Assert.assertTrue(gsConfig.getGoldstandard() == gs2);

    /*
     * REMOVE
     */

    /*
     * First check, whether listeners of goldstandardconfigs are notified
     * correctly when the goldstandardconfig is replaced
     */
    child.notified = false;
    gsConfig.notify(new RepositoryRemoveEvent(gsConfig));
    Assert.assertTrue(child.notified);

    /*
     * Now check, whether goldstandard configs remove themselves when their
     * goldstandard is removed
     */
    // gsconfig has to be registered
    Assert.assertTrue(getRepository().getRegisteredObject(gsConfig) == gsConfig);

    gsConfig.notify(new RepositoryRemoveEvent(gs2));

    // not registered anymore
    Assert.assertTrue(getRepository().getRegisteredObject(gsConfig) == null);
}

From source file:de.clusteval.data.dataset.TestDataSetConfig.java

/**
 * Test method for/*from w  w  w  .  j a  v  a  2s.c  o  m*/
 * {@link data.dataset.DataSetConfig#notify(utils.RepositoryEvent)} .
 * 
 * @throws DataSetNotFoundException
 * @throws NoRepositoryFoundException
 * @throws DataSetConfigurationException
 * @throws UnknownDataSetFormatException
 * @throws DataSetConfigNotFoundException
 * @throws UnknownDistanceMeasureException
 * @throws RegisterException
 * @throws UnknownDataPreprocessorException
 * @throws NumberFormatException
 * @throws IncompatibleDataSetConfigPreprocessorException
 * @throws UnknownRunDataStatisticException
 * @throws UnknownRunStatisticException
 * @throws UnknownDataStatisticException
 * @throws NoOptimizableProgramParameterException
 * @throws UnknownParameterOptimizationMethodException
 * @throws IncompatibleParameterOptimizationMethodException
 * @throws UnknownRProgramException
 * @throws UnknownProgramTypeException
 * @throws UnknownProgramParameterException
 * @throws InvalidOptimizationParameterException
 * @throws UnknownRunResultFormatException
 * @throws IncompatibleContextException
 * @throws RunException
 * @throws UnknownClusteringQualityMeasureException
 * @throws UnknownParameterType
 * @throws FileNotFoundException
 * @throws UnknownContextException
 * @throws ConfigurationException
 * @throws DataConfigNotFoundException
 * @throws DataConfigurationException
 * @throws GoldStandardConfigNotFoundException
 * @throws GoldStandardConfigurationException
 * @throws GoldStandardNotFoundException
 */
@Test
public void testNotifyRepositoryEvent() throws NoRepositoryFoundException, DataSetNotFoundException,
        DataSetConfigurationException, UnknownDataSetFormatException, DataSetConfigNotFoundException,
        UnknownDistanceMeasureException, RegisterException, UnknownDataSetTypeException, NoDataSetException,
        NumberFormatException, UnknownDataPreprocessorException, IncompatibleDataSetConfigPreprocessorException,
        GoldStandardNotFoundException, GoldStandardConfigurationException, GoldStandardConfigNotFoundException,
        DataConfigurationException, DataConfigNotFoundException, ConfigurationException,
        UnknownContextException, FileNotFoundException, UnknownParameterType,
        UnknownClusteringQualityMeasureException, RunException, IncompatibleContextException,
        UnknownRunResultFormatException, InvalidOptimizationParameterException,
        UnknownProgramParameterException, UnknownProgramTypeException, UnknownRProgramException,
        IncompatibleParameterOptimizationMethodException, UnknownParameterOptimizationMethodException,
        NoOptimizableProgramParameterException, UnknownDataStatisticException, UnknownRunStatisticException,
        UnknownRunDataStatisticException {

    /*
     * REPLACE
     */

    /*
     * First check, whether listeners of DataSetconfigs are notified
     * correctly when the DataSetconfig is replaced
     */
    DataSetConfig gsConfig = Parser.parseFromFile(DataSetConfig.class,
            new File("testCaseRepository/data/datasets/configs/astral_1.dsconfig").getAbsoluteFile());
    StubRepositoryObject child = new StubRepositoryObject(getRepository(), false, System.currentTimeMillis(),
            new File("testCaseRepository/Bla"));
    gsConfig.addListener(child);

    DataSetConfig gsConfig2 = new DataSetConfig(gsConfig);

    gsConfig.notify(new RepositoryReplaceEvent(gsConfig, gsConfig2));
    Assert.assertTrue(child.notified);

    /*
     * Now check, whether DataSet configs update their references correctly,
     * when their DataSet is replaced
     */
    RelativeDataSet gs = (RelativeDataSet) (gsConfig.getDataSet());
    RelativeDataSet gs2 = new RelativeDataSet(gs);

    gsConfig.notify(new RepositoryReplaceEvent(gs, gs2));

    Assert.assertFalse(gsConfig.getDataSet() == gs);
    Assert.assertTrue(gsConfig.getDataSet() == gs2);

    /*
     * REMOVE
     */

    /*
     * First check, whether listeners of DataSetconfigs are notified
     * correctly when the DataSetconfig is replaced
     */
    child.notified = false;
    gsConfig.notify(new RepositoryRemoveEvent(gsConfig));
    Assert.assertTrue(child.notified);

    /*
     * Now check, whether DataSet configs remove themselves when their
     * DataSet is removed
     */
    // gsconfig has to be registered
    Assert.assertTrue(getRepository().getRegisteredObject(gsConfig) == gsConfig);

    gsConfig.notify(new RepositoryRemoveEvent(gs2));

    // not registered anymore
    Assert.assertTrue(getRepository().getRegisteredObject(gsConfig) == null);
}

From source file:de.hybris.platform.b2badmin.services.impl.B2BUnitServiceTest.java

@Ignore
public void changeInActiveStateTriggersWarningMessage() {

    //test warning triggered when changing active state to false
    final B2BUnitModel unit = b2bUnitService.getUnitForUid("GC Sales UK");
    unit.setActive(Boolean.FALSE);
    modelService.save(unit);/*from  ww w . j a v  a  2 s .  c  o  m*/
    Set<HybrisConstraintViolation> constraintViolations = validationService.validate(unit);

    Assert.assertTrue(checkForB2BUnitActiveAnnotation(constraintViolations));
    Assert.assertFalse(unit.getActive().booleanValue());
    Assert.assertTrue(modelService.isUpToDate(unit));

    //test warning triggered when changing active state to true
    unit.setActive(Boolean.TRUE);
    modelService.save(unit);
    constraintViolations = validationService.validate(unit);

    Assert.assertTrue(checkForB2BUnitActiveAnnotation(constraintViolations));
    Assert.assertTrue(unit.getActive().booleanValue());
    Assert.assertTrue(modelService.isUpToDate(unit));
}

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

@Test
public void shouldUnStarBookmark() {
    final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open");
    final List<InstaRecordBean> folders = client.listFolders();
    final InstaRecordBean firstFolder = folders.get(0);
    final InstaRecordBean initBookmark = client.addBookmark("http://news.ycombinator.com/", "ProgressTest",
            firstFolder.folder_id, false);
    final InstaRecordBean staredBookmark = client.starBookmark(initBookmark.bookmark_id);
    Assert.assertTrue(staredBookmark.starred);
    Assert.assertFalse(client.unstarBookmark(initBookmark.bookmark_id).starred);
}

From source file:com.ebay.cloud.cms.query.service.QueryPaginationTest.java

@Test
public void testQueryIterSkip03_hint2() {
    String query = "ApplicationService.services[@name=~\"srp.*\"].runsOn";
    raptorContext.setLimits(new int[] { 0, 0, 0 });
    raptorContext.setSkips(new int[] { 0, 11, 0 });
    // compare to 03_hint : we have default sort order on _oid, so the hint doesn't affect the result 
    raptorContext.setHint(1);/*from   w w w  .  j  av a  2 s .  c o m*/
    IQueryResult result = queryService.query(query, raptorContext);
    Assert.assertFalse(result.hasMoreResults());
    Assert.assertEquals(0, result.getEntities().size());
}

From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java

@Test
public void testQueryIterSkip01() {
    String oid = null;/*w ww .  ja  va 2s .c  om*/
    {
        String query = "ApplicationService{@_oid}.services[@name=~\"srp.*\"].runsOn";
        QueryContext context = newQueryContext(RAPTOR_REPO, RAPTOR_MAIN_BRANCH_ID);
        context.setAllowFullTableScan(true);
        IQueryResult result = queryService.query(query, context);
        oid = result.getEntities().get(0).getId();
    }
    String query = "ApplicationService.services[@name=~\"srp.*\"].runsOn";
    raptorContext.setAllowFullTableScan(true);
    raptorContext.setPaginationMode(PaginationMode.ID_BASED);
    raptorContext.removeSortOn();
    raptorContext.getQueryCursor().setJoinCursorValues(Arrays.asList(oid, null, null));
    IQueryResult result = queryService.query(query, raptorContext);
    Assert.assertFalse(result.hasMoreResults());
    Assert.assertEquals(0, result.getEntities().size());
}

From source file:BQJDBC.QueryResultTest.BQResultSetFunctionTest.java

@Test
public void TestResultSetAbsolute() {
    try {//from   w ww.  j a va2s  .  c  om
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(1));
        Assert.assertEquals("you", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(2));
        Assert.assertEquals("yet", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(3));
        Assert.assertEquals("would", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(4));
        Assert.assertEquals("world", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(5));
        Assert.assertEquals("without", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(6));
        Assert.assertEquals("with", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(7));
        Assert.assertEquals("your", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(8));
        Assert.assertEquals("young", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(9));
        Assert.assertEquals("words", BQResultSetFunctionTest.Result.getString(1));
        Assert.assertTrue(BQResultSetFunctionTest.Result.absolute(10));
        Assert.assertEquals("word", BQResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        this.logger.error("SQLexception" + e.toString());
        Assert.fail("SQLException" + e.toString());
    }

    try {
        Assert.assertFalse(BQResultSetFunctionTest.Result.absolute(0));
        Assert.assertEquals("", BQResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        boolean ct = e.toString().contains("Cursor is not in a valid Position");
        if (ct == true) {
            Assert.assertTrue(ct);
        } else {
            this.logger.error("SQLexception" + e.toString());
            Assert.fail("SQLException" + e.toString());
        }
    }

    try {
        Assert.assertFalse(BQResultSetFunctionTest.Result.absolute(11));
        Assert.assertEquals("", BQResultSetFunctionTest.Result.getString(1));
    } catch (SQLException e) {
        boolean ct = e.toString().contains("Cursor is not in a valid Position");
        if (ct == true) {
            Assert.assertTrue(ct);
        } else {
            this.logger.error("SQLexception" + e.toString());
            Assert.fail("SQLException" + e.toString());
        }
    }
}