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:org.sonatype.nexus.plugins.rrb.MavenRepositoryReaderIT.java

@Test
// ( timeout = 5000 )
public void testAmazon_20110112_slashRoot() {
    // Fetched from URI http://repository.springsource.com/?prifix=maven/bundles/release&delimiter=/
    // and http://repository.springsource.com/maven/bundles/release/
    List<RepositoryDirectory> result = reader.extract("/", localUrl,
            getFakeProxyRepository(getRemoteUrl() + "Amazon_20110112/maven/bundles/release"), "test");
    assertEquals("Result: " + result, 2, result.size());

    RepositoryDirectory repositoryDirectory1 = result.get(0);
    Assert.assertFalse(repositoryDirectory1.isLeaf());
    Assert.assertEquals(localUrl + "/com/", repositoryDirectory1.getResourceURI());
    Assert.assertEquals("/com/", repositoryDirectory1.getRelativePath());

    RepositoryDirectory repositoryDirectory2 = result.get(1);
    Assert.assertFalse(repositoryDirectory2.isLeaf());
    Assert.assertEquals(localUrl + "/org/", repositoryDirectory2.getResourceURI());
    Assert.assertEquals("/org/", repositoryDirectory2.getRelativePath());
}

From source file:me.buom.shiro.test.AppTest.java

@Test
@Repeat(times = 3, warmUp = 1)/*from  w w w  .  j  ava2s .  c  om*/
public void test_superviser_create() throws Exception {

    URL url = new URL(baseUrl.toExternalForm() + "superviser_create");
    HttpGet method = new HttpGet(url.toURI());

    String contentType = "application/json; charset=utf-8";
    Header[] headers = buildHeader(ApiKey.SUPERVISER, method, contentType, null);

    method.setHeaders(headers);

    HttpResponse execute = client.execute(method);
    StatusLine statusLine = execute.getStatusLine();

    printResponse(execute);
    printHeader(execute);

    Assert.assertFalse(statusLine.getStatusCode() != 200);
}

From source file:es.tekniker.framework.ktek.commons.mng.server.test.TestCommonsMngServer.java

public void testDeleteUserToken() {

    log.info("*************************************************************");
    log.info("testDeleteUserToken: START ");
    String result = TestDefines.RESULT_OK;

    KtekUserEntity instance = null;//w w w .  j a  v a  2  s  . co  m

    CommonsMngServer manager = new CommonsMngServer();

    String codUser = "newuser1";
    boolean boolOK = false;
    try {
        boolOK = manager.deleteUser(codUser);

        if (boolOK) {
            System.out.println("testDeleteUserToken OK ");
            result = TestDefines.RESULT_OK;
            Assert.assertFalse(true);
        } else {
            log.error("testDeleteUserToken: ERROR ");
            result = TestDefines.RESULT_ERROR;
            Assert.assertNull(instance);
        }

    } catch (KtekExceptionEntity e) {
        System.out.println("testDeleteUserToken :  exception " + e.getMessage());
        e.printStackTrace();
        Assert.assertFalse(false);
    }

    log.info("testDeleteUserToken: RESULT " + result);
    log.info("testDeleteUserToken: END ");
    log.info("*************************************************************");
    log.info("");

}

From source file:org.opencastproject.distribution.download.DownloadDistributionServiceImplTest.java

@Test
public void testRetractByOriginal() throws Exception {
    // Distribute the mediapackage and all of its elements
    Job job1 = service.distribute("engage-player", mp, "track-1");
    Job job2 = service.distribute("engage-player", mp, "catalog-1");
    Job job3 = service.distribute("engage-player", mp, "catalog-2");
    Job job4 = service.distribute("engage-player", mp, "notes");
    Job job5 = service.distribute("oai-pmh", mp, "track-1");
    JobBarrier jobBarrier = new JobBarrier(serviceRegistry, 500, job1, job2, job3, job4, job5);
    jobBarrier.waitForJobs();//from   www .j  a  v  a 2  s.  com

    // Add the new elements to the mediapackage
    mp.add(MediaPackageElementParser.getFromXml(job1.getPayload()));
    mp.add(MediaPackageElementParser.getFromXml(job2.getPayload()));
    mp.add(MediaPackageElementParser.getFromXml(job3.getPayload()));
    mp.add(MediaPackageElementParser.getFromXml(job4.getPayload()));
    mp.add(MediaPackageElementParser.getFromXml(job5.getPayload()));

    File mpDir = new File(distributionRoot, PathSupport.path("engage-player", mp.getIdentifier().compact()));
    File mediaDir = new File(mpDir, "track-1");
    File metadata1Dir = new File(mpDir, "catalog-1");
    File metadata2Dir = new File(mpDir, "catalog-2");
    File attachmentsDir = new File(mpDir, "notes");
    Assert.assertTrue(mediaDir.exists());
    Assert.assertTrue(metadata1Dir.exists());
    Assert.assertTrue(metadata2Dir.exists());
    Assert.assertTrue(attachmentsDir.exists());
    Assert.assertTrue(new File(mediaDir, "media.mov").exists()); // the filenames are changed to reflect the element ID
    Assert.assertTrue(new File(metadata1Dir, "dublincore.xml").exists());
    Assert.assertTrue(new File(metadata2Dir, "mpeg7.xml").exists());
    Assert.assertTrue(new File(attachmentsDir, "attachment.txt").exists());

    // Now retract the mediapackage and ensure that the distributed files have been removed
    Job job6 = service.retract("engage-player", mp, "track-1");
    Job job7 = service.retract("engage-player", mp, "catalog-1");
    Job job8 = service.retract("engage-player", mp, "catalog-2");
    Job job9 = service.retract("engage-player", mp, "notes");
    jobBarrier = new JobBarrier(serviceRegistry, 500, job6, job7, job8, job9);
    jobBarrier.waitForJobs();

    Assert.assertFalse(service.getDistributionFile("engage-player", mp, mp.getElementById("track-1")).isFile());
    Assert.assertFalse(
            service.getDistributionFile("engage-player", mp, mp.getElementById("catalog-1")).isFile());
    Assert.assertFalse(
            service.getDistributionFile("engage-player", mp, mp.getElementById("catalog-2")).isFile());
    Assert.assertFalse(service.getDistributionFile("engage-player", mp, mp.getElementById("notes")).isFile());
    Assert.assertTrue(service.getDistributionFile("oai-pmh", mp, mp.getElementById("track-1")).isFile());
}

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#intersects(Span)}.
     *//*from   w w w.  j  av  a2s.c  o  m*/
    public void testIntersects() {
        Span a = new Span(10, 50);
        Span b = new Span(40, 100);

        Assert.assertTrue(a.intersects(b));
        Assert.assertTrue(b.intersects(a));

        Span c = new Span(10, 20);
        Span d = new Span(40, 50);

        Assert.assertFalse(c.intersects(d));
        Assert.assertFalse(d.intersects(c));

        Assert.assertTrue(b.intersects(d));
    }

From source file:es.tekniker.framework.ktek.questionnaire.mng.server.test.TestQuestionnaireMngServer.java

public void testSaveKtekQuestionnaireAssesment3() {
    log.info("*************************************************************");
    log.info("testSaveKtekQuestionnaireAssesment3: START ");
    String result = TestDefines.RESULT_OK;

    String token = null;/*from w  ww  .  j a va2 s.  com*/
    KtekQuestionnaireResultEntity resultData = null;
    QuestionnaireMngServer manager = new QuestionnaireMngServer();
    int boolOK = 0;

    try {

        token = TestData.getLoginToken();
        resultData = es.tekniker.framework.ktek.questionnaire.mng.db.TestData
                .getKtekQuestionnaireAssessmentResultEntity3();

        boolOK = manager.saveQuestionnaireModel(token, resultData);

        if (boolOK == 1) {
            log.info("testSaveKtekQuestionnaireAssesment3: SAVE OK ");
            Assert.assertTrue(true);
        } else {
            log.error("testSaveKtekQuestionnaireAssesment3: SAVE ERROR ");
            result = TestDefines.RESULT_ERROR;
            Assert.assertTrue(false);
        }

    } catch (KtekExceptionEntity e) {
        System.out.println("testSaveKtekQuestionnaireAssesment3:  exception " + e.getMessage());
        e.printStackTrace();
        Assert.assertFalse(false);
    }

    log.info("testSaveKtekQuestionnaireAssesment3: RESULT " + result);
    log.info("testSaveKtekQuestionnaireAssesment3: END ");
    log.info("*************************************************************");
    log.info("");

}

From source file:at.tfr.securefs.process.ProcessFilesTest.java

@Test
public void testValidationFailsWrongSecretToByWalkFileHierarchy() throws Exception {

    // Given: NO target directory yet!!, the source file
    generateFileHierarchy(fromRoot, 0, MAX_DIR_DEPTH, cp, secret);
    Assert.assertFalse(Files.exists(toRoot.resolve(DATA_FILES)));
    Assert.assertFalse(Files.exists(targetToFile));
    ProcessFiles pf = new ProcessFilesBean(new MockSecureFsCache());
    ProcessFilesData cfd = new ProcessFilesData();

    // Then we can generate a full hierarchy copy
    generateHierachyCopy(pf, cfd);//from   w  ww.j a  va2  s  .c o  m

    // Then both hierarchies cannot be validated with bad secret:
    pf.verify(toRoot, cp, secret, cfd);
    Assert.assertFalse("verification failed", cfd.getErrors().isEmpty());

    cfd.getErrors().clear();
    cfd.setLastError((String) null);
    pf.verifyDecryption(generateSomeFile(toRoot), cp, secret, cfd);
    Assert.assertTrue("no error on validation", cfd.getErrors().size() == 1);
    Assert.assertTrue("no error on validation",
            cfd.getErrors().entrySet().iterator().next().getValue().contains("IOException"));
    Assert.assertTrue("no error on validation", cfd.getLastError().contains("IOException"));

}

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

@Test
public void testService03() {
    QueryContext tempContext = newQueryContext(RAPTOR_REPO, RAPTOR_MAIN_BRANCH_ID);
    tempContext.setPaginationMode(PaginationMode.ID_BASED);
    tempContext.setAllowFullTableScan(true);

    IQueryResult result = queryService.query("ApplicationService.services{@name}.runsOn{@name}", tempContext);
    List<IEntity> services = (List<IEntity>) result.getEntities();

    Assert.assertEquals(10, services.size());
    Assert.assertEquals("srp-app:Raptor-00002", services.get(0).getFieldValues("name").get(0));
    Assert.assertEquals("srp-app:Raptor-00003", services.get(1).getFieldValues("name").get(0));
    Assert.assertFalse(result.hasMoreResults());
    Assert.assertNull(result.getNextCursor());
}

From source file:org.wso2.carbon.apimgt.handlers.AuthenticationHandlerTest.java

@Test(description = "Handle request with URI exception", dependsOnMethods = "testHandleRequestWithIOException")
public void testHandleRequestWithURIException() throws Exception {
    TestUtils.resetSystemProperties();//from  w  ww  .j a v a2  s  .  c o  m
    HashMap<String, String> transportHeaders = new HashMap<>();
    transportHeaders.put(AuthConstants.MDM_SIGNATURE, "some cert");
    AuthenticationHandler handler = new AuthenticationHandler();
    boolean response = handler.handleRequest(createSynapseMessageContext("<empty/>", this.synapseConfiguration,
            transportHeaders, "https://test.com/testservice/api/testdevice"));
    Assert.assertFalse(response);
    TestUtils.setSystemProperties();
}

From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java

@Test
public void testIsAcceptedServiceInterface3() {
    final AutowiredRemoteServiceGroupConfig config;

    config = new AutowiredRemoteServiceGroupConfig();
    config.setBasePackages(Arrays.asList(new String[] { "de.itsvs.cwtrpc.controller.config2." }));

    Assert.assertFalse(config.isAcceptedServiceInterface(Pattern.class));
    Assert.assertFalse(config.isAcceptedServiceInterface(TestService10.class));
}