Example usage for junit.framework AssertionFailedError getMessage

List of usage examples for junit.framework AssertionFailedError getMessage

Introduction

In this page you can find the example usage for junit.framework AssertionFailedError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.micromata.genome.junittools.wicket.WicketTestBuilder.java

/**
 * TODO RK make them protected.//ww  w  . j a va 2  s.c o  m
 * 
 * @param pageClass the class which to validate
 * @return the builder
 * @throws TpsbWicketWrongPageException when the page is not the requested
 */
@Deprecated
public T _validateRenderedPage(Class<? extends Page> pageClass) throws TpsbWicketWrongPageException {
    try {
        tester.assertRenderedPage(pageClass);
    } catch (AssertionFailedError ex) {
        fail(new TpsbWicketWrongPageException(ex.getMessage(), this));
    } catch (Throwable ex) { // NOSONAR "Illegal Catch" framework
        fail("Assertion failed: " + ex.getMessage());
    }
    return getBuilder();
}

From source file:org.usapi.BaseSeleniumTest.java

private void logFailedAssertion(String assertionMsg, AssertionFailedError afe) {
    log.error("Assertion failed: " + assertionMsg);
    log.error("Error message: " + afe.getMessage());
    log.error(getStacktraceAsString(afe));

}

From source file:com.facebook.FacebookActivityTestCase.java

protected void waitAndAssertSuccess(TestBlocker testBlocker, int numSignals) {
    try {/*from w ww.  ja v  a 2  s  . co  m*/
        testBlocker.waitForSignalsAndAssertSuccess(numSignals);
    } catch (AssertionFailedError e) {
        throw e;
    } catch (Exception e) {
        fail("Got exception: " + e.getMessage());
    }
}

From source file:org.alfresco.repo.version.VersionServiceImplTest.java

/**
 * Same as testIdsOutOfOrder but without the comparator so should fail.
 *///ww w . jav  a 2  s  .c  o  m
public void testIdsOutOfOrderFails() {
    if (versionService instanceof Version2ServiceImpl) {
        try {
            setOutOfOrderIdsVersionService("");
            testGetVersionHistorySameWorkspace();
            fail("Expected this to fail");
        } catch (AssertionFailedError e) {
            System.out.print("A test failed as EXPECTED: " + e.getMessage());
        }
    }
}

From source file:org.apache.axis2.transport.testkit.axis2.client.AxisTestClient.java

public void afterReceive() throws Exception {
    if (sender instanceof ManagementSupport) {
        ManagementSupport sender = (ManagementSupport) this.sender;
        synchronized (metrics) {
            long start = System.currentTimeMillis();
            while (true) {
                try {
                    Assert.assertEquals(1, metrics.getMessagesSent());
                    Assert.assertEquals(messagesSent + 1, sender.getMessagesSent());
                    long thisBytesSent = metrics.getBytesSent();
                    Assert.assertTrue("No increase in bytes sent in message level metrics", thisBytesSent != 0);
                    long newBytesSent = sender.getBytesSent();
                    Assert.assertTrue("No increase in bytes sent in transport level metrics",
                            newBytesSent > bytesSent);
                    Assert.assertEquals("Mismatch between message and transport level metrics", thisBytesSent,
                            newBytesSent - bytesSent);
                    break;
                } catch (AssertionFailedError ex) {
                    // SYNAPSE-491: Maybe the transport sender didn't finish updating the
                    // metrics yet. We give it a couple of seconds to do so.
                    long remaining = start + 5000 - System.currentTimeMillis();
                    if (remaining <= 0) {
                        throw ex;
                    } else {
                        log.debug("The transport sender didn't update the metrics yet (" + ex.getMessage()
                                + "). Waiting for " + remaining + " ms.");
                        metrics.wait(remaining);
                    }/*from w  w w .  java2  s.c  o m*/
                }
            }
        }
        log.debug("Message level metrics check OK");
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail1() {
    String query = " foreach (group (A = load 'a') by $1) generate A.'1' ;";
    try {/*from  www .  j a v a2  s . c om*/
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail2() {
    String query = "foreach group (load 'a') by $1 generate $1.* ;";
    try {//from  w w  w  . j  a v  a 2  s  .  c  o  m
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail3() {
    String query = "generate DISTINCT foreach (load 'a');";
    try {/*  w ww  . j ava  2s.c  o m*/
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail4() {
    String query = "generate [ORDER BY $0][$3, $4] foreach (load 'a');";
    try {//from   w  ww . ja va  2  s . co m
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail5() {
    String query = "generate " + TestApplyFunc.class.getName() + "($2.*) foreach (load 'a');";
    try {/* ww w . j  a va 2s.  c  o  m*/
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}