Tabnine Logo
TestMethod
Code IndexAdd Tabnine to your IDE (free)

How to use
TestMethod
in
org.junit.internal.runners

Best Java code snippets using org.junit.internal.runners.TestMethod (Showing top 20 results out of 315)

origin: junit-team/junit4

protected void runTestMethod() {
  try {
    testMethod.invoke(test);
    if (testMethod.expectsException()) {
      addFailure(new AssertionError("Expected exception: " + testMethod.getExpectedException().getName()));
    }
  } catch (InvocationTargetException e) {
    Throwable actual = e.getTargetException();
    if (actual instanceof AssumptionViolatedException) {
      return;
    } else if (!testMethod.expectsException()) {
      addFailure(actual);
    } else if (testMethod.isUnexpected(actual)) {
      String message = "Unexpected exception, expected<" + testMethod.getExpectedException().getName() + "> but was<"
          + actual.getClass().getName() + ">";
      addFailure(new Exception(message, actual));
    }
  } catch (Throwable e) {
    addFailure(e);
  }
}
origin: junit-team/junit4

protected TestMethod wrapMethod(Method method) {
  return new TestMethod(method, testClass);
}
origin: junit-team/junit4

private void runAfters() {
  List<Method> afters = testMethod.getAfters();
  for (Method after : afters) {
    try {
      after.invoke(test);
    } catch (InvocationTargetException e) {
      addFailure(e.getTargetException());
    } catch (Throwable e) {
      addFailure(e); // Untested, but seems impossible
    }
  }
}
origin: junit-team/junit4

public void run() {
  if (testMethod.isIgnored()) {
    notifier.fireTestIgnored(description);
    return;
  }
  notifier.fireTestStarted(description);
  try {
    long timeout = testMethod.getTimeout();
    if (timeout > 0) {
      runWithTimeout(timeout);
    } else {
      runTest();
    }
  } finally {
    notifier.fireTestFinished(description);
  }
}
origin: junit-team/junit4

boolean expectsException() {
  return getExpectedException() != null;
}
origin: junit-team/junit4

private void runBefores() throws FailedBefore {
  try {
    try {
      List<Method> befores = testMethod.getBefores();
      for (Method before : befores) {
        before.invoke(test);
      }
    } catch (InvocationTargetException e) {
      throw e.getTargetException();
    }
  } catch (AssumptionViolatedException e) {
    throw new FailedBefore();
  } catch (Throwable e) {
    addFailure(e);
    throw new FailedBefore();
  }
}
origin: org.apache.isis.viewer/junit

  @Override
  public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
    super.invoke(testFixture);
    if (mockeryField != null) {
      mockeryOf(testFixture).assertIsSatisfied();
    }
  }
};
origin: google/j2objc

public void run() {
  if (fTestMethod.isIgnored()) {
    fNotifier.fireTestIgnored(fDescription);
    return;
  }
  fNotifier.fireTestStarted(fDescription);
  try {
    long timeout = fTestMethod.getTimeout();
    if (timeout > 0) {
      runWithTimeout(timeout);
    } else {
      runTest();
    }
  } finally {
    fNotifier.fireTestFinished(fDescription);
  }
}
origin: google/j2objc

boolean expectsException() {
  return getExpectedException() != null;
}
origin: google/j2objc

private void runBefores() throws FailedBefore {
  try {
    try {
      List<Method> befores = fTestMethod.getBefores();
      for (Method before : befores) {
        before.invoke(fTest);
      }
    } catch (InvocationTargetException e) {
      throw e.getTargetException();
    }
  } catch (AssumptionViolatedException e) {
    throw new FailedBefore();
  } catch (Throwable e) {
    addFailure(e);
    throw new FailedBefore();
  }
}
origin: org.nakedobjects/headless-viewer

  @Override
  public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
    super.invoke(testFixture);
    if (mockeryField != null) {
      mockeryOf(testFixture).assertIsSatisfied();
    }
  }
};
origin: google/j2objc

protected void runTestMethod() {
  try {
    fTestMethod.invoke(fTest);
    if (fTestMethod.expectsException()) {
      addFailure(new AssertionError("Expected exception: " + fTestMethod.getExpectedException().getName()));
    }
  } catch (InvocationTargetException e) {
    Throwable actual = e.getTargetException();
    if (actual instanceof AssumptionViolatedException) {
      return;
    } else if (!fTestMethod.expectsException()) {
      addFailure(actual);
    } else if (fTestMethod.isUnexpected(actual)) {
      String message = "Unexpected exception, expected<" + fTestMethod.getExpectedException().getName() + "> but was<"
          + actual.getClass().getName() + ">";
      addFailure(new Exception(message, actual));
    }
  } catch (Throwable e) {
    addFailure(e);
  }
}
origin: camunda/camunda-bpm-platform

public void run() {
  if (fTestMethod.isIgnored()) {
    fNotifier.fireTestIgnored(fDescription);
    return;
  }
  fNotifier.fireTestStarted(fDescription);
  try {
    long timeout = fTestMethod.getTimeout();
    if (timeout > 0) {
      runWithTimeout(timeout);
    } else {
      runTest();
    }
  } finally {
    fNotifier.fireTestFinished(fDescription);
  }
}
origin: google/j2objc

protected TestMethod wrapMethod(Method method) {
  return new TestMethod(method, fTestClass);
}
origin: junit-team/junit4

boolean isUnexpected(Throwable exception) {
  return !getExpectedException().isAssignableFrom(exception.getClass());
}
origin: google/j2objc

private void runAfters() {
  List<Method> afters = fTestMethod.getAfters();
  for (Method after : afters) {
    try {
      after.invoke(fTest);
    } catch (InvocationTargetException e) {
      addFailure(e.getTargetException());
    } catch (Throwable e) {
      addFailure(e); // Untested, but seems impossible
    }
  }
}
origin: camunda/camunda-bpm-platform

private void runBefores() throws FailedBefore {
  try {
    try {
      List<Method> befores = fTestMethod.getBefores();
      for (Method before : befores) {
        before.invoke(fTest);
      }
    } catch (InvocationTargetException e) {
      throw e.getTargetException();
    }
  } catch (AssumptionViolatedException e) {
    throw new FailedBefore();
  } catch (Throwable e) {
    addFailure(e);
    throw new FailedBefore();
  }
}
origin: org.nakedobjects/headlessviewer-viewer

  @Override
  public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
    super.invoke(testFixture);
    if (mockeryField != null) {
      mockeryOf(testFixture).assertIsSatisfied();
    }
  }
};
origin: camunda/camunda-bpm-platform

protected void runTestMethod() {
  try {
    fTestMethod.invoke(fTest);
    if (fTestMethod.expectsException()) {
      addFailure(new AssertionError("Expected exception: " + fTestMethod.getExpectedException().getName()));
    }
  } catch (InvocationTargetException e) {
    Throwable actual = e.getTargetException();
    if (actual instanceof AssumptionViolatedException) {
      return;
    } else if (!fTestMethod.expectsException()) {
      addFailure(actual);
    } else if (fTestMethod.isUnexpected(actual)) {
      String message = "Unexpected exception, expected<" + fTestMethod.getExpectedException().getName() + "> but was<"
          + actual.getClass().getName() + ">";
      addFailure(new Exception(message, actual));
    }
  } catch (Throwable e) {
    addFailure(e);
  }
}
origin: com.oracle/truffle-tck

public void run() {
  if (fTestMethod.isIgnored()) {
    fNotifier.fireTestIgnored(fDescription);
    return;
  }
  fNotifier.fireTestStarted(fDescription);
  try {
    long timeout = fTestMethod.getTimeout();
    if (timeout > 0) {
      runWithTimeout(timeout);
    } else {
      runTest();
    }
  } finally {
    fNotifier.fireTestFinished(fDescription);
  }
}
org.junit.internal.runnersTestMethod

Most used methods

  • invoke
  • <init>
  • expectsException
  • getAfters
  • getBefores
  • getExpectedException
  • getTimeout
  • isIgnored
  • isUnexpected

Popular in Java

  • Updating database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • startActivity (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Runner (org.openjdk.jmh.runner)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now