Package org.junit.internal

Examples of org.junit.internal.AssumptionViolatedException


      //to a skip
      try {
        validatePathLen(path, len);
      } catch (AssertionError e) {
        //downgrade to a skip
        throw new AssumptionViolatedException(e, null);
      }

    } finally {
      IOUtils.closeStream(out);
    }
View Full Code Here


      catch (Throwable th) {
          testResult = TestResult.failed(th);
      }
      // AssumptionViolatedException might not be Serializable. Recreate with only String message.
      if(testResult.getThrowable() instanceof AssumptionViolatedException) {
          testResult = TestResult.skipped(new AssumptionViolatedException(testResult.getThrowable().getMessage()));
      }
      testResult.setEnd(System.currentTimeMillis());
      return testResult;
   }
View Full Code Here

      } catch (Throwable t) {
        // Special handling for assumption exceptions. They contain unserializable data, so we create a new
        // one that doesn't contain this extra info.
        if (t instanceof InvocationTargetException) {
          InvocationTargetException ite = (InvocationTargetException) t;
          AssumptionViolatedException ave = JuObjectUtils.as(ite.getTargetException(), AssumptionViolatedException.class);
          if (ave != null) {
            throw new AssumptionViolatedException(ave.getMessage());
          }
        }
        throw t;
      }
      txHandler.commit(); // Perform a commit after the execution of the test method
View Full Code Here

  /**
   * Check on zombie threads status.
   */
  static void checkZombies() throws AssumptionViolatedException {
    if (zombieMarker.get()) {
      throw new AssumptionViolatedException("Leaked background threads present (zombies).");
    }
  }
View Full Code Here

      } catch (Throwable t) {
        throw new RuntimeException("Error collecting parameters from: " + m, t);
      }

      if (result.isEmpty()) {
        throw new AssumptionViolatedException("Parameters set should not be empty. Ignoring tests.");
      }

      parameters.addAll(result);
    }
View Full Code Here

  public static Matcher<?> NULL= null;

  @Theory
  public void toStringReportsMatcher(Object actual, Matcher<?> matcher) {
    assumeThat(matcher, notNullValue());
    assertThat(new AssumptionViolatedException(actual, matcher).toString(),
        containsString(matcher.toString()));
  }
View Full Code Here

        containsString(matcher.toString()));
  }

  @Theory
  public void toStringReportsValue(Object actual, Matcher<?> matcher) {
    assertThat(new AssumptionViolatedException(actual, matcher).toString(),
        containsString(String.valueOf(actual)));
  }
View Full Code Here

        containsString(String.valueOf(actual)));
  }

  @Test
  public void AssumptionViolatedExceptionDescribesItself() {
    AssumptionViolatedException e= new AssumptionViolatedException(3, is(2));
    assertThat(StringDescription.asString(e), is("got: <3>, expected: is <2>"));
  }
View Full Code Here

    assertThat(StringDescription.asString(e), is("got: <3>, expected: is <2>"));
  }

  @Test
  public void simpleAssumptionViolatedExceptionDescribesItself() {
    AssumptionViolatedException e= new AssumptionViolatedException("not enough money");
    assertThat(StringDescription.asString(e), is("failed assumption: not enough money"));
  }
View Full Code Here

        private class CheckDBRule implements MethodRule {

            private final AssumptionViolatedException assume;

            public CheckDBRule(KiWiConfiguration dbConfig) {
                AssumptionViolatedException ex = null;
                try {
                    DBConnectionChecker.checkDatabaseAvailability(dbConfig);
                } catch (AssumptionViolatedException ave) {
                    ex = ave;
                }
View Full Code Here

TOP

Related Classes of org.junit.internal.AssumptionViolatedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.