Example usage for java.lang AssertionError getMessage

List of usage examples for java.lang AssertionError getMessage

Introduction

In this page you can find the example usage for java.lang AssertionError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.aliyun.openservices.odps.console.utils.CommandParserUtils.java

private static void parseInteractiveCommand(List<AbstractCommand> commandList, String commandText,
        ExecutionContext sessionContext, int queryNumber) throws ODPSConsoleException {

    if (ecList == null) {
        ecList = PluginUtil.getExtendCommandList();
    }/*  w w  w .  jav  a  2s  .co  m*/

    for (int i = 0; i < INTERACTIVE_COMMANDS.length; i++) {

        String commandName = COMMAND_PACKAGE + "." + INTERACTIVE_COMMANDS[i];
        // ?
        ecList.add(new PluginPriorityCommand(commandName, PluginPriorityCommand.MAX_PRIORITY));
    }

    // console?

    String userCommands = sessionContext.getUserCommands();

    if (userCommands != null) {
        // ????
        for (String commandString : Arrays.asList(userCommands.split(","))) {
            ecList.add(new PluginPriorityCommand(commandString, PluginPriorityCommand.MAX_PRIORITY));
        }

    }
    // QueryCommand,
    ecList.add(new PluginPriorityCommand(COMMAND_PACKAGE + "." + "QueryCommand",
            PluginPriorityCommand.MIN_PRIORITY));
    Collections.sort(ecList);

    for (PluginPriorityCommand command : ecList) {
        String commandName = command.getCommandName();
        if (commandName != null && !"".equals(commandName.trim())) {
            AbstractCommand cmd = null;
            try {
                cmd = reflectCommandObject(commandName, new Class<?>[] { String.class, ExecutionContext.class },
                        commandText, sessionContext);
            } catch (AssertionError e) {
                // ?,console???
                sessionContext.getOutputWriter().writeDebug(e.getMessage());
                System.err.println("fail to load user command, pls check:" + commandName);
            }

            if (cmd != null) {
                cmd.setCommandStep(queryNumber);
                addCommand(commandList, cmd, sessionContext);
                return;
            }
        }
    }
}

From source file:org.asamk.signal.Main.java

private static void handleAssertionError(AssertionError e) {
    System.err.println("Failed to send/receive message (Assertion): " + e.getMessage());
    e.printStackTrace();/*from ww  w  . j a va  2 s  .  c  o m*/
    System.err.println(
            "If you use an Oracle JRE please check if you have unlimited strength crypto enabled, see README");
    System.exit(1);
}

From source file:net.javacrumbs.smock.common.MessageMatcherCompareTest.java

@Test
public void testInvalid() throws Exception {
    try {/*from ww w.j  a va  2  s  .c o  m*/
        compareDocuments("control-message-test.xml", "invalid-message.xml");
        fail("Exception expected");
    } catch (AssertionError e) {
        assertFalse(e.getMessage().contains("[not identical]"));
    }
}

From source file:org.marketcetera.util.test.CollectionAssertTest.java

@Test
public void sameLengthDifferentElements() {
    try {//from   w w w .  ja  va  2 s .c  o m
        assertArrayPermutation(new Integer[] { null }, new Integer[] { 2 });
    } catch (AssertionError ex) {
        assertEquals("actual is missing 'null'", ex.getMessage());
        return;
    }
    fail();
}

From source file:org.marketcetera.util.test.CollectionAssertTest.java

@Test
public void actualShorter() {
    try {//from  w  w w .j  a v a  2 s. c om
        assertArrayPermutation(new Integer[] { null, null }, new Integer[] { null });
    } catch (AssertionError ex) {
        assertEquals("actual is missing 'null'", ex.getMessage());
        return;
    }
    fail();
}

From source file:org.marketcetera.util.test.CollectionAssertTest.java

@Test
public void message() {
    try {/*w  w w  .jav a  2 s .  c  o m*/
        assertArrayPermutation("Right now,", new Integer[] { 1 }, new Integer[] { 2 });
    } catch (AssertionError ex) {
        assertEquals("Right now, actual is missing '1'", ex.getMessage());
        return;
    }
    fail();
}

From source file:ar.com.zauber.commons.dao.closure.SwitchClosureTest.java

/** test */
@Test/* www . ja v a  2  s.c  om*/
public final void testname() throws Exception {
    final List<Entry<Predicate<String>, Closure<String>>> blocks = new LinkedList<Entry<Predicate<String>, Closure<String>>>();

    final Predicate<String> never = new FalsePredicate<String>();
    final Predicate<String> always = new TruePredicate<String>();

    final List<String> l = new LinkedList<String>();
    final Closure<String> putInList = new Closure<String>() {
        public void execute(final String t) {
            l.add(t);
        }
    };

    blocks.add(new PredicateClosureEntry<String>(never, new AssertFalseClosure<String>("no debe entrar aca")));
    blocks.add(new PredicateClosureEntry<String>(new EqualsPredicate("foo"), putInList));
    blocks.add(new PredicateClosureEntry<String>(always, new AssertFalseClosure<String>("default block")));

    final Closure<String> s = new SwitchClosure<String>(blocks);
    s.execute("foo");
    Assert.assertEquals("foo", l.get(0));
    l.clear();
    try {
        s.execute("bar");
        Assert.fail("shouldnt reach this point");
    } catch (final AssertionError e) {
        Assert.assertEquals("default block", e.getMessage());
    }

}

From source file:org.sonar.test.i18n.BundleSynchronizedMatcherTest.java

@Test
public void shouldNotMatch() {
    try {//from ww  w .j  a  va 2 s .c o m
        assertThat("myPlugin_fr.properties", matcher);
        assertTrue(new File("target/l10n/myPlugin_fr.properties.report.txt").exists());
    } catch (AssertionError e) {
        assertThat(e.getMessage(), containsString("Missing translations are:\nsecond.prop"));
        assertThat(e.getMessage(), containsString(
                "The following translations do not exist in the reference bundle:\nfourth.prop"));
    }
}

From source file:com.meltmedia.cadmium.blackbox.test.endpoints.UpdateEndpointTest.java

@Override
public void postTest() throws Exception {
    try {//from  w  w w  . ja v  a2s .  c o  m
        waitForDeployment();
        assertContentDeployed("Failed to update content.", new File(TEST_UPDATED_CONTENT_LOCATION), DEPLOY_URL,
                "tester", "tester");
        System.out.println("Passed post test...");
    } catch (AssertionError e) {
        fail("Post test failed: " + e.getMessage());
    }
}

From source file:org.marketcetera.util.test.CollectionAssertTest.java

@Test
public void expectedNull() {
    try {//from  w ww . j a  v a2  s. co  m
        assertArrayPermutation(null, ArrayUtils.EMPTY_STRING_ARRAY);
    } catch (AssertionError ex) {
        assertEquals("expected array is null but actual is not", ex.getMessage());
        return;
    }
    fail();
}