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:loaders.LoadQueryTransformerTest.java

@Test
public void testParentBandCondition() throws Exception {
    String query = "select id as id from user where id  =  ${Root.parentBandParam}";
    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  ww  w .  j  a  va 2  s. co  m

    BandData parentBand = new BandData("Root");
    parentBand.setData(new HashMap<String, Object>());
    parentBand.addData("parentBandParam", "parentBandParam");
    queryPack = prepareQuery(query, parentBand, params);
    System.out.println(queryPack.getQuery());
    Assert.assertEquals(1, StringUtils.countMatches(queryPack.getQuery(), "?"));
    writeParams(queryPack);
}

From source file:de.hybris.basecommerce.SimpleSmtpServerUtilsTest.java

@Test
public void testSendSuccess() throws EmailException, AddressException {
    final String origMailPortNumber = Config.getParameter(Config.Params.MAIL_SMTP_PORT);
    final String origMailHost = Config.getParameter(Config.Params.MAIL_SMTP_SERVER);

    SimpleSmtpServer server = null;/*from  w  ww  .  j  av  a  2  s .co m*/
    try {
        server = SimpleSmtpServerUtils.startServer(TEST_START_PORT);
        Assert.assertFalse(server.isStopped());
        Assert.assertTrue(server.getPort() > 0);

        Config.setParameter(Config.Params.MAIL_SMTP_SERVER, "localhost");
        Config.setParameter(Config.Params.MAIL_SMTP_PORT, String.valueOf(server.getPort()));

        final Email email = MailUtils.getPreConfiguredEmail();

        email.setFrom("foo.bar@hybris.com");
        email.setTo(Arrays.asList(InternetAddress.parse("foo.bar@hybris.com")));
        email.setSubject("TEST TEST TEST");
        email.setContent("FOO", Email.TEXT_PLAIN);

        email.send();
    } finally {
        Config.setParameter(Config.Params.MAIL_SMTP_SERVER, origMailHost);
        Config.setParameter(Config.Params.MAIL_SMTP_PORT, origMailPortNumber);

        if (server != null) {
            server.stop();
        }
    }
}

From source file:com.googlecode.wickedcharts.highcharts.jackson.JsonIgnoreTest.java

@Test
public void test() {
    // given/* ww w.  ja v a  2 s. c o m*/
    Options options = new MyOptions();
    ChartOptions chartOptions = new ChartOptions();
    chartOptions.setType(SeriesType.AREA);
    options.setChartOptions(chartOptions);
    JsonRenderer renderer = new JsonRenderer();

    // when
    String json = renderer.toJson(options);

    // then
    Assert.assertFalse(json.contains("myIgnoredField"));
    Assert.assertTrue(json.contains("myIncludedField"));
}

From source file:com.github.neoio.net.message.staging.memory.TestMemoryMessageStaging.java

@Test
public void test_tempWrite() {
    ByteBuffer buffer = ByteBuffer.allocate(1024);

    buffer.put("Hello World".getBytes());
    buffer.rewind();//from  www  .j  a  va2 s .c o m
    staging.writeTempWriteBytes(buffer);
    Assert.assertTrue(staging.hasTempWriteBytes());

    buffer.clear();
    staging.readTempWriteBytes(buffer);
    Assert.assertEquals("Hello World",
            new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length)));
    staging.resetTempWriteBytes();

    Assert.assertFalse(staging.hasTempWriteBytes());
}

From source file:com.tasktop.c2c.server.configuration.service.tests.TemplateProcessingConfiguratorTest.java

@Test
public void testBasicTemplating() {
    Assert.assertFalse(targetDir.exists());

    ProjectServiceConfiguration conf = new ProjectServiceConfiguration();
    conf.setProperties(new HashMap<String, String>());
    conf.getProperties().put("a.key", "a.value");
    conf.getProperties().put("b.key", "b.value");
    conf.getProperties().put("c.key", "c.value");
    conf.setProjectIdentifier("testId");

    templateProcessingConfigurator.configure(conf);

    Assert.assertTrue(targetDir.exists());
    Assert.assertTrue(targetDir.isDirectory());
}

From source file:org.openmrs.web.controller.GlobalPropertyPortletControllerTest.java

/**
 * @see GlobalPropertyPortletController#populateModel(HttpServletRequest,Map)
 *///from w  w w .j  ava  2 s.  c om
@SuppressWarnings("unchecked")
@Test
@Verifies(value = "should exclude multiple prefixes", method = "populateModel(HttpServletRequest,Map<String,Object>)")
public void populateModel_shouldExcludeMultiplePrefixes() throws Exception {
    //given
    GlobalPropertyPortletController portletController = new GlobalPropertyPortletController();
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "");
    Map<String, Object> model = new HashMap<String, Object>();

    //when
    String excludePrefix = "file.started;file.mandatory";
    model.put("excludePrefix", excludePrefix);
    GlobalProperty[] globalProperties = { new GlobalProperty("file.started", ""),
            new GlobalProperty("file.mandatory", ""), new GlobalProperty("file.other", "") };
    Context.getAdministrationService().saveGlobalProperties(Arrays.asList(globalProperties));

    //then
    portletController.populateModel(request, model);
    List<GlobalProperty> properties = (List<GlobalProperty>) model.get("properties");
    Assert.assertFalse(properties.contains(globalProperties[0]));
    Assert.assertFalse(properties.contains(globalProperties[1]));
    Assert.assertTrue(properties.contains(globalProperties[2]));
}

From source file:io.cloudslang.lang.compiler.modeller.transformers.DoTransformerTest.java

@Test
public void testTransformExpression() throws Exception {
    Map doArgumentsMap = loadFirstTaskFromFile("/flow_with_data.yaml");
    @SuppressWarnings("unchecked")
    List<Argument> arguments = doTransformer.transform(doArgumentsMap);
    Assert.assertFalse(arguments.isEmpty());
    Assert.assertEquals(2, arguments.size());
    Argument argument = arguments.iterator().next();
    Assert.assertEquals("city", argument.getName());
    Assert.assertEquals("city_name", argument.getValue());
    Assert.assertEquals(false, argument.isOverridable());
}

From source file:com.rackspacecloud.blueflood.io.serializers.astyanax.CounterRollupSerializationTest.java

@Test
public void testCounterV1RoundTrip() throws IOException {
    BluefloodCounterRollup c0 = new BluefloodCounterRollup().withCount(7442245).withSampleCount(1);
    BluefloodCounterRollup c1 = new BluefloodCounterRollup().withCount(34454722343L).withSampleCount(10);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    baos.write(Base64.encodeBase64(Serializers.counterRollupInstance.toByteBuffer(c0).array()));
    baos.write("\n".getBytes());
    baos.write(Base64.encodeBase64(Serializers.counterRollupInstance.toByteBuffer(c1).array()));
    baos.write("\n".getBytes());

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    BufferedReader reader = new BufferedReader(new InputStreamReader(bais));

    ByteBuffer bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes()));
    BluefloodCounterRollup cc0 = Serializers.serializerFor(BluefloodCounterRollup.class).fromByteBuffer(bb);
    Assert.assertEquals(c0, cc0);//from  w  w  w.  j a  v  a2 s.  c o m

    bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes()));
    BluefloodCounterRollup cc1 = Serializers.serializerFor(BluefloodCounterRollup.class).fromByteBuffer(bb);

    Assert.assertEquals(c1, cc1);
    Assert.assertFalse(cc0.equals(cc1));
}

From source file:org.openscore.lang.compiler.modeller.transformers.InputsTransformerTest.java

@Test
public void testTransform() throws Exception {
    @SuppressWarnings("unchecked")
    List<Input> inputs = inputTransformer.transform(inputsMap);
    Assert.assertFalse(inputs.isEmpty());
}

From source file:org.openscore.lang.runtime.navigations.NavigationsTest.java

@Test
public void errorNavigationTest() throws Exception {

    RunEnvironment runEnv = new RunEnvironment();
    Long nextStepId = 2L;/* www  .jav a 2  s  . co  m*/
    runEnv.putNextStepPosition(nextStepId);
    ExecutionRuntimeServices runtimeServices = new ExecutionRuntimeServices();
    runtimeServices.setStepErrorKey("Error");
    Long nextPosition = navigations.navigate(runEnv, runtimeServices);

    Collection<ScoreEvent> events = runtimeServices.getEvents();

    Assert.assertNull(nextPosition);

    Assert.assertFalse(events.isEmpty());
    ScoreEvent stepErrorEvent = null;
    for (ScoreEvent event : events) {
        if (event.getEventType().equals(SLANG_EXECUTION_EXCEPTION)) {
            stepErrorEvent = event;
        }
    }
    Assert.assertNotNull(stepErrorEvent);
}