Java Thread Callable runTest(Callable test)

Here you can find the source of runTest(Callable test)

Description

run Test

License

Open Source License

Declaration

public static void runTest(Callable<Void> test) throws Exception 

Method Source Code

//package com.java2s;
/*//w  ww  .  jav  a 2  s.  c  om
 * AutoRefactor - Eclipse plugin to automatically refactor Java code bases.
 *
 * Copyright (C) 2016-2017 Jean-No?l Rouvignac - initial API and implementation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program under LICENSE-GNUGPL.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution under LICENSE-ECLIPSE, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 */

import java.util.concurrent.Callable;

public class Main {
    public static void runTest(Callable<Void> test) throws Exception {
        try {
            test.call();
        } catch (RuntimeException e) {
            if ("org.autorefactor.util.UnhandledException".equals(e.getClass().getName())
                    || "Unexpected exception".equals(e.getMessage())) {
                throw (Exception) e.getCause();
            }
            throw e;
        }
    }
}

Related

  1. runAndRethrowRuntimeExceptionOnFailure(final Callable operation, final String exceptionMessage)
  2. runConcurrently(final Callable task)
  3. runConcurrently(final Callable task)
  4. runConcurrently(final Callable task, final int times)
  5. runInBackground(final Callable callable)
  6. runWithTimeout(long millisTimeout, Callable callable)
  7. shuffleRow(final double[] data)
  8. submitAndWait(ListeningExecutorService service, Callable ca)
  9. submitManyAndWait(ListeningExecutorService service, Iterable> cas, FutureCallback fca)