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:io.druid.indexer.HdfsClasspathSetupTest.java

@Test
public void testIsSnapshot() {
    Assert.assertTrue(JobHelper.isSnapshot(new File("test-SNAPSHOT.jar")));
    Assert.assertTrue(JobHelper.isSnapshot(new File("test-SNAPSHOT-selfcontained.jar")));
    Assert.assertFalse(JobHelper.isSnapshot(new File("test.jar")));
    Assert.assertFalse(JobHelper.isSnapshot(new File("test-selfcontained.jar")));
    Assert.assertFalse(JobHelper.isSnapshot(new File("iAmNotSNAPSHOT.jar")));
    Assert.assertFalse(JobHelper.isSnapshot(new File("iAmNotSNAPSHOT-selfcontained.jar")));

}

From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java

@Test
public void testPaperMedicalRecordExistsReturnsFalseIfIdentifierVoided() {

    // from the standard test dataset
    Location medicalRecordLocation = locationService.getLocation(1);

    // this identifier exists in the standard test data set
    Assert.assertFalse(paperRecordService.paperRecordExistsWithIdentifier("DOGBALL", medicalRecordLocation));
}

From source file:com.impetus.client.cassandra.config.CassandraPropertyReaderTest.java

/**
 * Test method for/*w w w  .  ja v a 2  s. c  o  m*/
 * {@link com.impetus.client.cassandra.config.CassandraPropertyReader#readProperty()}
 * .
 * 
 * @throws IOException
 */
@Test
public void testReadProperty() throws IOException {
    log.info("running CassandraPropertyReaderTest");
    // reader = new CassandraPropertyReader();
    // reader.read("CassandraCounterTest");
    EntityManagerFactory emf = Persistence.createEntityManagerFactory(pu);
    PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(pu);
    // metadata = CassandraPropertyReader.csmd;
    Properties properties = new Properties();
    InputStream inStream = ClassLoader
            .getSystemResourceAsStream(puMetadata.getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY));

    if (inStream != null) {
        properties.load(inStream);
        replication = properties.getProperty(Constants.REPLICATION_FACTOR);
        strategy = properties.getProperty(Constants.PLACEMENT_STRATEGY);
        String dataCenters = properties.getProperty(Constants.DATA_CENTERS);
        if (dataCenters != null) {
            StringTokenizer stk = new StringTokenizer(dataCenters, ",");
            while (stk.hasMoreTokens()) {
                StringTokenizer tokenizer = new StringTokenizer(stk.nextToken(), ":");
                if (tokenizer.countTokens() == 2) {
                    dataCenterToNode.put(tokenizer.nextToken(), tokenizer.nextToken());
                }
            }
        }

        String cf_defs = properties.getProperty(Constants.CF_DEFS);
        if (cf_defs != null) {
            StringTokenizer stk = new StringTokenizer(cf_defs, ",");
            while (stk.hasMoreTokens()) {
                CassandraColumnFamilyProperties familyProperties = new CassandraColumnFamilyProperties();
                StringTokenizer tokenizer = new StringTokenizer(stk.nextToken(), "|");
                if (tokenizer.countTokens() != 0 && tokenizer.countTokens() >= 2) {
                    String columnFamilyName = tokenizer.nextToken();
                    String defaultValidationClass = tokenizer.nextToken();
                    familyProperties.setDefault_validation_class(defaultValidationClass);

                    if (tokenizer.countTokens() != 0) {
                        String comparator = tokenizer.nextToken();

                        familyProperties.setComparator(comparator);

                    }
                    familyToProperties.put(columnFamilyName, familyProperties);
                }
            }
        }

        metadata = CassandraPropertyReader.csmd;
        if (replication != null) {
            Assert.assertNotNull(replication);
            Assert.assertNotNull(metadata.getReplication_factor());

        } else {
            Assert.assertNull(replication);
            Assert.assertNull(metadata.getReplication_factor());
        }
        Assert.assertEquals(replication, metadata.getReplication_factor());

        if (strategy != null) {
            Assert.assertNotNull(strategy);
            Assert.assertNotNull(metadata.getPlacement_strategy());

        } else {
            Assert.assertNull(strategy);
            Assert.assertNull(metadata.getPlacement_strategy());
        }
        Assert.assertEquals(strategy, metadata.getPlacement_strategy());

        if (!familyToProperties.isEmpty()) {
            Assert.assertNotNull(familyToProperties);
            Assert.assertNotNull(metadata.getColumnFamilyProperties());
            Assert.assertFalse(metadata.getColumnFamilyProperties().isEmpty());
        } else {
            Assert.assertTrue(metadata.getColumnFamilyProperties().isEmpty());
        }
        Assert.assertEquals(familyToProperties.size(), metadata.getColumnFamilyProperties().size());

        if (!dataCenterToNode.isEmpty()) {
            Assert.assertNotNull(dataCenterToNode);
            Assert.assertNotNull(metadata.getDataCenters());
            Assert.assertFalse(metadata.getDataCenters().isEmpty());
        } else {
            Assert.assertTrue(metadata.getDataCenters().isEmpty());
        }
        Assert.assertEquals(dataCenterToNode.size(), metadata.getDataCenters().size());
    } else {
        Assert.assertEquals("1", metadata.getReplication_factor());
        Assert.assertEquals(SimpleStrategy.class.getName(), metadata.getPlacement_strategy());
        Assert.assertEquals(0, metadata.getDataCenters().size());
        Assert.assertEquals(0, metadata.getColumnFamilyProperties().size());
    }
}

From source file:org.openmrs.module.emrapi.account.AccountComponentTest.java

@Test
public void shouldLoadExistingPersonAndUserAndProvider() {

    Role fullPrivileges = userService.getRole("Privilege Level: Full");
    Role archives = userService.getRole("Application Role: Archives");
    Role registration = userService.getRole("Application Role: Registration");

    ProviderRole nurse = providerManagementService.getProviderRole(1001);

    Person person = personService.getPerson(501); // existing person with user account in test dataset

    AccountDomainWrapper account = accountService.getAccountByPerson(person);

    Assert.assertEquals("Bruno", account.getGivenName());
    Assert.assertEquals("Otterbourg", account.getFamilyName());
    Assert.assertEquals("F", account.getGender());

    Assert.assertFalse(account.getUserEnabled()); // this user account happens to be retired in test dataset
    Assert.assertEquals("bruno", account.getUsername());
    Assert.assertEquals("fr", account.getDefaultLocale().toString());
    Assert.assertTrue(account.getPrivilegeLevel().equals(fullPrivileges));
    Assert.assertEquals(2, account.getCapabilities().size());
    Assert.assertTrue(account.getCapabilities().contains(archives));
    Assert.assertTrue(account.getCapabilities().contains(registration));

    Assert.assertEquals(nurse, account.getProviderRole());

}

From source file:de.hybris.platform.servicelayer.media.impl.DefaultMediaPermissionServiceIntegrationTest.java

/**
 * Test method for//w ww  . ja v  a 2s  .  c om
 * {@link de.hybris.platform.servicelayer.media.impl.DefaultMediaPermissionService#grantReadPermission(de.hybris.platform.core.model.media.MediaModel, de.hybris.platform.core.model.security.PrincipalModel)}
 * .
 */
@Test
public void testGrantPermission() {
    final UserModel testUser = modelService.create(UserModel.class);
    testUser.setUid("testGroup");
    testUser.setName("Testgroup");
    modelService.save(testUser);

    final PermissionAssignment testAssignment = new PermissionAssignment(PermissionsConstants.READ, testUser);
    final Collection<PermissionAssignment> permAssignments = permissionManagementService
            .getItemPermissionsForPrincipal(testMediaItem, testUser);

    Assert.assertFalse(permAssignments.contains(testAssignment));

    mediaPermissionService.grantReadPermission(testMediaItem, testUser);
    final PermissionCheckResult checkResult = permissionCheckingService.checkItemPermission(testMediaItem,
            testUser, PermissionsConstants.READ);

    Assert.assertTrue(checkResult.isGranted());
}

From source file:io.smartspaces.master.server.services.internal.comm.StandardMasterRosContextTest.java

/**
 * Test shutting down the context./*  w w w .  jav  a2 s  . c  om*/
 *
 * <p>
 * This test using a remote ROS master.
 */
//@Test
public void testShutdownRemoteRosMaster() {
    Mockito.when(systemConfiguration.getPropertyBoolean(MasterRosContext.CONFIGURATION_NAME_ROS_MASTER_ENABLE,
            MasterRosContext.CONFIGURATION_VALUE_DEFAULT_ROS_MASTER_ENABLE)).thenReturn(false);

    context.startup();

    context.shutdown();
    Mockito.verify(masterNode).shutdown();

    // Wrong pieces in place for the node to call its listeners, so call
    // directly.
    context.getMasterNodeListener().onShutdownComplete(context.getMasterNode());
    Assert.assertFalse(rosMasterController.isShutdownCalled());
}

From source file:org.openmrs.module.printer.PrinterServiceComponentTest.java

@Test
public void testShouldReturnFalseIfAnotherPrinterDoesNotHaveSameName() {

    Printer differentPrinter = new Printer();
    differentPrinter.setName("Test Printer With Different Name");
    differentPrinter.setIpAddress("192.1.1.9");
    differentPrinter.setType(PrinterType.LABEL);

    Assert.assertFalse(printerService.isNameAllocatedToAnotherPrinter(differentPrinter));
}

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

@org.junit.Test
public void testRandomLetters() {

    String result = TestDefines.RESULT_OK;

    log.info("*************************************************************");
    log.info("testRandomLetters: START ");

    CommonsMngServer manager = new CommonsMngServer();
    String[] array = manager.getRandomLetters();

    if (array != null) {
        for (int i = 0; i < array.length; i++) {
            log.info(array[i]);/*from   w ww  . j a va  2 s.  c om*/
        }

        Assert.assertTrue(true);
    } else {
        Assert.assertFalse(false);
    }

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

}

From source file:functionalTests.vfsprovider.TestProActiveProvider.java

private void removeTestDir() {
    AbstractIOOperationsBase.deleteRecursively(testDir);
    Assert.assertFalse(testDir.exists());
}

From source file:loaders.LoadQueryTransformerTest.java

@Test
public void testParamReordering2() throws Exception {
    String query = "select \n" + "u.id as initiatorId,\n" + "u.name as initiator,\n" + "count(*) as tasks,\n"
            + "count(case when c.state = ',InWork,' or c.state = ',Assigned,' then 1 end) as tasksInWork,\n"
            + "count(case when c.state = ',InControl,' or c.state = ',Completed,' then 1 end) as tasksOnControl,\n"
            + "count(case when ((c.state = ',InControl,' or c.state = ',InWork,' or c.state = ',Assigned,' or c.state = ',Completed,') \n"
            + "    and t.finish_date_plan <= ${date}) then 1 end) as overdue\n" + "\n"
            + "from (select distinct r.card_id from wf_card_role r where r.delete_ts is null \n"
            + "and (r.code='10-Initiator' or r.code='20-Executor' or r.code='30-Controller' or r.code='90-Observer')\n"
            + "and r.user_id = ${runs}) as r\n" + "join tm_task t on t.card_id = r.card_id \n"
            + "join wf_card c on t.card_id = c.id\n"
            + "join  (select card_id, user_id from wf_card_role where delete_ts is null and code='20-Executor') as execut on execut.card_id = t.card_id\n"
            + "join df_employee e on execut.user_id = e.user_id\n"
            + "join sec_user u on t.initiator_id = u.id\n" + "\n" + "where c.delete_ts is null\n"
            + "and (c.state = ',InControl,' or c.state = ',InWork,' or c.state = ',Completed,' or c.state = ',Assigned,')\n"
            + "and t.create_date <= ${date}\n" + "and e.user_id = ${executorId}\n" + "group by u.id, u.name\n"
            + "order by u.name";
    HashMap<String, Object> params = new HashMap<String, Object>();
    AbstractDbDataLoader.QueryPack queryPack = prepareQuery(query, new BandData(""), params);
    System.out.println(queryPack.getQuery());
    Assert.assertFalse(queryPack.getQuery().contains("${"));
    writeParams(queryPack);//from w  w w .ja v  a  2 s. co m

    params.put("date", "param1");
    params.put("executorId", "param2");
    params.put("runs", null);
    queryPack = prepareQuery(query, new BandData(""), params);
    System.out.println(queryPack.getQuery());
    Assert.assertEquals(3, StringUtils.countMatches(queryPack.getQuery(), "?"));
    writeParams(queryPack);

    Assert.assertEquals("param1", queryPack.getParams()[0].getValue());
    Assert.assertEquals("param1", queryPack.getParams()[1].getValue());
    Assert.assertEquals("param2", queryPack.getParams()[2].getValue());
}