Example usage for junit.framework Assert assertTrue

List of usage examples for junit.framework Assert assertTrue

Introduction

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

Prototype

static public void assertTrue(String message, boolean condition) 

Source Link

Document

Asserts that a condition is true.

Usage

From source file:ca.simplegames.micro.RoutingTest.java

/**
 * test static content (binary) served from a dynamic repository, using the support of
 * {@link ca.simplegames.micro.controllers.BinaryContent}
 *
 * @throws Exception//from  w w w  .  ja v  a 2  s .co m
 */
@Test
public void testBinaryContent() throws Exception {
    Context<String> input = new MapContext<String>().with(Rack.REQUEST_METHOD, "GET").with(Rack.PATH_INFO,
            "/micro-logo.png");

    RackResponse response = micro.call(input);
    Assert.assertTrue("Can't load binary content from a dynamic repository",
            RackResponse.getBodyAsBytes(response).length == 6898);

    Assert.assertTrue("Invalid Content-Type header",
            RackResponse.getHeaders(response).get("Content-Type").equalsIgnoreCase(Mime.mimeType(".png")));
}

From source file:com.indoqa.maven.wadldoc.transformation.Wadl2HtmlPipelineTest.java

@Test
public void stylesheet() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    new Wadl2HtmlPipeline(this.getClass().getResource("wadl.xml"), "stylesheet.css", true).execute(baos);

    Assert.assertNotNull(baos);/*from ww  w  .j av  a2  s . co m*/
    Diff diff = createDiff("test2-result.html", baos);
    Assert.assertTrue("Pieces of XML are not identical. " + diff, diff.similar());
}

From source file:com.btobits.automator.fix.ant.task.FixStartTask.java

@Override
protected void runTestInstructions() throws Exception {
    final Object obj = getProject().getReference(refId);
    Assert.assertNotNull("RefId[" + refId + "]. Failed to get FIX session.", obj);
    Assert.assertTrue("RefId[" + refId + "]. Unknown FIX session mode: " + obj.getClass().getSimpleName(),
            (obj instanceof IControl));
    ((IControl) obj).start();//from   w w  w  .  j  av  a  2 s.c  o m
}

From source file:com.redblackit.web.controller.AdminControllerTest.java

/**
 * Helper method to run tests using about
 *//* w w w  .ja  va 2s .co m*/
private void doTestAbout() {
    ExtendedModelMap model = new ExtendedModelMap();

    adminController.about(model);

    Object versionInfoObj = model.get("versionInfo");
    Assert.assertNotNull("versionInfo model attribute", versionInfoObj);
    Assert.assertTrue("versionInfo is of type CompositeVersionInfo:" + versionInfoObj.getClass(),
            versionInfoObj instanceof CompositeVersionInfo);

    CompositeVersionInfo returnedVersionInfo = (CompositeVersionInfo) versionInfoObj;
    Assert.assertEquals("returned versionInfo", getExpectedCompositeVersionInfo(), returnedVersionInfo);
}

From source file:com.atlassian.jira.rest.client.TestUtil.java

@SuppressWarnings("unused")
public static <T extends Throwable> void assertThrows(Class<T> clazz, String regexp, Runnable runnable) {
    try {//from   www .  j a va 2 s  .c o m
        runnable.run();
        Assert.fail(clazz.getName() + " exception expected");
    } catch (Throwable e) {
        Assert.assertTrue(
                "Expected exception of class " + clazz.getName() + " but was caught " + e.getClass().getName(),
                clazz.isInstance(e));
        if (e.getMessage() == null && regexp != null) {
            Assert.fail("Exception with no message caught, while expected regexp [" + regexp + "]");
        }
        if (regexp != null && e.getMessage() != null) {
            Assert.assertTrue("Message [" + e.getMessage() + "] does not match regexp [" + regexp + "]",
                    e.getMessage().matches(regexp));
        }
    }

}

From source file:org.openscore.lang.runtime.bindings.OutputsBindingTest.java

@Test(timeout = DEFAULT_TIMEOUT)
public void testOperationEmptyOutputs() throws Exception {
    Map<String, Serializable> operationContext = new HashMap<>();
    Map<String, Serializable> actionReturnValues = new HashMap<>();
    List<Output> outputs = new LinkedList<>();

    Map<String, Serializable> result = outputsBinding.bindOutputs(operationContext, actionReturnValues,
            outputs);//from  w w  w . j  a  v  a  2s .  c  om

    Assert.assertTrue("result cannot be null", result != null);
    Assert.assertTrue("result should be empty", result.isEmpty());
}

From source file:org.openspaces.eviction.test.ClassSpecificOrderTest.java

public void assertMultiThreadedOperationsTest() {
    logger.info("assert only objects with none are left");
    Assert.assertTrue("not all objects in space are of the highest priority",
            gigaSpace.count(new Object()) == gigaSpace.count(new GoldMedal()) + 1
                    || gigaSpace.count(new Object()) == gigaSpace.count(new GoldMedal()));
}

From source file:com.btobits.automator.fix.ant.task.FixStopTask.java

@Override
protected void runTestInstructions() throws Exception {
    final Object obj = getProject().getReference(refId);
    Assert.assertNotNull("RefId[" + refId + "]. Failed to get FIX session.", obj);
    Assert.assertTrue("RefId[" + refId + "]. Unknown FIX session mode: " + obj.getClass().getSimpleName(),
            (obj instanceof IControl));
    ((IControl) obj).stop(sendLogout);/*  ww w .ja v  a2s.  com*/
}

From source file:io.cloudslang.lang.runtime.bindings.OutputsBindingTest.java

@Test(timeout = DEFAULT_TIMEOUT)
public void testOperationEmptyOutputs() {
    Map<String, Serializable> operationContext = new HashMap<>();
    Map<String, Serializable> actionReturnValues = new HashMap<>();
    List<Output> outputs = new LinkedList<>();

    Map<String, Serializable> result = outputsBinding.bindOutputs(operationContext, actionReturnValues,
            EMPTY_SET, outputs);/*ww  w  . j  a  v a  2  s  . c  o m*/

    Assert.assertTrue("result cannot be null", result != null);
    Assert.assertTrue("result should be empty", result.isEmpty());
}

From source file:com.btobits.automator.fix.ant.task.FixWaitForLoginTask.java

@Override
protected void validate() {
    Assert.assertTrue("Reference to FIX session is not specified", StringUtils.isNotBlank(refId));
    final Object obj = getProject().getReference(refId);
    Assert.assertNotNull("RefId[" + refId + "]. Failed to get FIX session.", obj);
    Assert.assertTrue("RefId[" + refId + "]. Unknown FIX session mode: " + obj.getClass().getSimpleName(),
            (obj instanceof FixSession));

    fixSession = (FixSession) obj;/*from  w  ww .  j a v a 2 s. co m*/
    conn = fixSession.getConnectivity();
    Assert.assertNotNull("RefId[" + refId + "]. getConnectivity() return NULL", conn);
}