示例#1
0
  /**
   * Checks that the given grid configuration will lead to {@link GridException} upon grid startup.
   *
   * @param cfg Grid configuration to check.
   * @param excMsgSnippet Root cause (assertion) exception message snippet.
   * @param testLoc {@code True} if checking is done for "testLocal" tests.
   */
  private void checkGridStartFails(
      GridConfiguration cfg, CharSequence excMsgSnippet, boolean testLoc) {
    assertNotNull(cfg);
    assertNotNull(excMsgSnippet);

    try {
      G.start(cfg);

      fail("No exception has been thrown.");
    } catch (GridException e) {
      if (testLoc) {
        if ("Failed to start processor: GridProcessorAdapter []".equals(e.getMessage())
            && e.getCause().getMessage().contains(excMsgSnippet)) return; // Expected exception.
      } else if (e.getMessage().contains(excMsgSnippet)) return; // Expected exception.

      error("Caught unexpected exception.", e);

      fail();
    }
  }