junit.framework.TestCase.runTest()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(321)

本文整理了Java中junit.framework.TestCase.runTest()方法的一些代码示例,展示了TestCase.runTest()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestCase.runTest()方法的具体详情如下:
包路径:junit.framework.TestCase
类名称:TestCase
方法名:runTest

TestCase.runTest介绍

[英]Override to run the test and assert its state.
[中]重写以运行测试并断言其状态。

代码示例

代码示例来源:origin: internetarchive/heritrix3

@Override
protected void runTest() throws Throwable {
  try {
    super.runTest();
  } catch (Throwable t) {
    t.printStackTrace();
    throw t;
  }
}

代码示例来源:origin: junit-team/junit4

/**
 * Runs the bare test sequence.
 *
 * @throws Throwable if any exception is thrown
 */
public void runBare() throws Throwable {
  Throwable exception = null;
  setUp();
  try {
    runTest();
  } catch (Throwable running) {
    exception = running;
  } finally {
    try {
      tearDown();
    } catch (Throwable tearingDown) {
      if (exception == null) exception = tearingDown;
    }
  }
  if (exception != null) throw exception;
}

代码示例来源:origin: google/j2objc

/**
 * Runs the bare test sequence.
 *
 * @throws Throwable if any exception is thrown
 */
public void runBare() throws Throwable {
  Throwable exception = null;
  setUp();
  try {
    runTest();
  } catch (Throwable running) {
    exception = running;
  } finally {
    try {
      tearDown();
    } catch (Throwable tearingDown) {
      if (exception == null) exception = tearingDown;
    }
  }
  if (exception != null) throw exception;
}

代码示例来源:origin: google/guava

protected void runTestProfiled() throws Throwable {
 long t0 = System.nanoTime();
 try {
  super.runTest();
 } finally {
  long elapsedMillis = (System.nanoTime() - t0) / (1000L * 1000L);
  if (elapsedMillis >= profileThreshold)
   System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
 }
}

代码示例来源:origin: Activiti/Activiti

@Override
protected void runTest() throws Throwable {
 if (log.isDebugEnabled()) {
  if (isEmptyLinesEnabled) {
   log.debug(EMPTY_LINE);
  }
  log.debug("#### START {}.{} ###########################################################", this.getClass().getSimpleName(), getName());
 }
 try {
  super.runTest();
 } catch (AssertionFailedError e) {
  log.error(EMPTY_LINE);
  log.error("ASSERTION FAILED: {}", e, e);
  throw e;
 } catch (Throwable e) {
  log.error(EMPTY_LINE);
  log.error("EXCEPTION: {}", e, e);
  throw e;
 } finally {
  log.debug("#### END {}.{} #############################################################", this.getClass().getSimpleName(), getName());
 }
}

代码示例来源:origin: google/guava

protected void runTest() throws Throwable {
 if (profileTests) runTestProfiled();
 else super.runTest();
}

代码示例来源:origin: ben-manes/caffeine

protected void runTestProfiled() throws Throwable {
  // Warmup run, notably to trigger all needed classloading.
  super.runTest();
  long t0 = System.nanoTime();
  try {
    super.runTest();
  } finally {
    long elapsedMillis = millisElapsedSince(t0);
    if (elapsedMillis >= profileThreshold) {
     System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
    }
  }
}

代码示例来源:origin: jankotek/mapdb

protected void runTest() throws Throwable {
  for (int i = 0; i < runsPerTest; i++) {
    // currentRun = i;
    if (profileTests)
      runTestProfiled();
    else
      super.runTest();
  }
}

代码示例来源:origin: Activiti/Activiti

@Override
protected void runTest() throws Throwable {
 // Support for mockup annotations on test method
 TestHelper.annotationMockSupportSetup(getClass(), getName(), mockSupport);
 // The deployment of processes denoted by @Deployment should
 // be done after the setup(). After all, the mockups must be
 // configured in the engine before the actual deployment happens
 deploymentId = TestHelper.annotationDeploymentSetUp(processEngine, getClass(), getName());
 super.runTest();
 // Remove deployment
 TestHelper.annotationDeploymentTearDown(processEngine, deploymentId, getClass(), getName());
 // Reset mocks
 TestHelper.annotationMockSupportTeardown(mockSupport);
}

代码示例来源:origin: ben-manes/caffeine

@Override
protected void runTest() throws Throwable {
  if (methodFilter == null
    || methodFilter.matcher(toString()).find()) {
    for (int i = 0; i < runsPerTest; i++) {
      if (profileTests) {
       runTestProfiled();
      } else {
       super.runTest();
      }
    }
  }
}

代码示例来源:origin: jankotek/mapdb

protected void runTestProfiled() throws Throwable {
  for (int i = 0; i < 2; i++) {
    long startTime = System.nanoTime();
    super.runTest();
    long elapsedMillis = millisElapsedSince(startTime);
    if (elapsedMillis < profileThreshold)
      break;
    // Never report first run of any test; treat it as a
    // warmup run, notably to trigger all needed classloading,
    if (i > 0)
      System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected void runTest() throws Throwable {
 if (!skipTest) {
  super.runTest();
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected void runTest() throws Throwable {
 if (!skipTest) {
  super.runTest();
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Runs the bare test sequence.
 *
 * @throws Throwable if any exception is thrown
 */
public void runBare() throws Throwable {
  Throwable exception = null;
  setUp();
  try {
    runTest();
  } catch (Throwable running) {
    exception = running;
  } finally {
    try {
      tearDown();
    } catch (Throwable tearingDown) {
      if (exception == null) exception = tearingDown;
    }
  }
  if (exception != null) throw exception;
}

代码示例来源:origin: org.apache.qpid/qpid-test-utils

@Override
protected void runTest() throws Throwable
{
  LOGGER.info("========== run " + getTestName() + " ==========");
  super.runTest();
}

代码示例来源:origin: com.blazegraph/bigdata-core-test

protected void runTestProfiled() throws Throwable {
  long t0 = System.nanoTime();
  try {
    super.runTest();
  } finally {
    long elapsedMillis =
      (System.nanoTime() - t0) / (1000L * 1000L);
    if (elapsedMillis >= profileThreshold)
      System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
  }
}

代码示例来源:origin: blazegraph/database

protected void runTest() throws Throwable {
  if (profileTests)
    runTestProfiled();
  else
    super.runTest();
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void runTest() throws Throwable {
  super.runTest();
  MockLogAppender.assertNoWarningsOrGreater();
}

代码示例来源:origin: com.google.guava/guava-tests

protected void runTest() throws Throwable {
  if (profileTests)
    runTestProfiled();
  else
    super.runTest();
}

代码示例来源:origin: OpenNMS/opennms

@Override
protected void runTest() throws Throwable {
  super.runTest();
  
  m_mocks.verifyAll();
}

相关文章