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

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

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

TestCase.tearDown介绍

[英]Tears down the fixture, for example, close a network connection. This method is called after a test is executed.
[中]例如,拆下固定装置,关闭网络连接。此方法在执行测试后调用。

代码示例

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

@Override
protected void tearDown() throws Exception {
 if (exec != null) {
  exec.shutdown();
 }
 super.tearDown();
}

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

@Override
public void tearDown() throws Exception {
 super.tearDown();
 LocalCache.logger.removeHandler(logHandler);
}

代码示例来源:origin: mcxiaoke/packer-ng-plugin

@Override
protected void tearDown() throws Exception {
  super.tearDown();
}

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

@Override
public void tearDown() throws Exception {
 super.tearDown();
 // TODO(cpovirk): run tests in other thread instead of messing with main thread interrupt status
 currentThread().interrupted();
 LocalCache.logger.removeHandler(logHandler);
}

代码示例来源:origin: commons-collections/commons-collections

protected void tearDown() throws Exception {
  super.tearDown();
}

代码示例来源:origin: apache/hive

@Override
protected void tearDown() throws Exception {
 super.tearDown();
}

代码示例来源: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: commons-validator/commons-validator

/**
 * Tear Down.
 */
@Override
protected void tearDown() throws Exception {
  super.tearDown();
}

代码示例来源: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: commons-validator/commons-validator

/**
 * @see junit.framework.TestCase#tearDown()
 */
@Override
protected void tearDown() throws Exception {
  super.tearDown();
}

代码示例来源:origin: commons-validator/commons-validator

/**
 * Tear down
 * @throws Exception
 */
@Override
protected void tearDown() throws Exception {
  super.tearDown();
  validator = null;
}

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

@Override
public void tearDown() throws Exception {
 /*
  * Clear interrupt for future tests.
  *
  * (Ideally we would perform interrupts only in threads that we create, but
  * it's hard to imagine that anything will break in practice.)
  */
 clearInterrupt();
 aggregateFutureLogger.removeHandler(aggregateFutureLogHandler);
 super.tearDown();
}

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

@Override
public void tearDown() throws Exception {
 super.tearDown();
 // TODO(cpovirk): run tests in other thread instead of messing with main thread interrupt status
 Thread.interrupted();
 logger.removeHandler(logHandler);
}

代码示例来源:origin: apache/hbase

@Override
protected void tearDown() throws Exception {
 try {
  if (localfs) {
   if (this.fs.exists(testDir)) {
    this.fs.delete(testDir, true);
   }
  }
 } catch (Exception e) {
  LOG.error(HBaseMarkers.FATAL, "error during tear down", e);
 }
 super.tearDown();
}

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

@Override
protected void tearDown() throws Exception {
 // Reset any timers
 processEngineConfiguration.getClock().reset();
 // Reset any mocks
 if (mockSupport != null) {
  mockSupport.reset();
 }
 super.tearDown();
}

代码示例来源:origin: typ0520/fastdex

@Override
protected void tearDown() throws Exception {
  super.tearDown();
  FileUtils.deleteDir(workDir);
}

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

@Override
protected void tearDown() throws Exception {
  SystemTime.reset();
  super.tearDown();
}

代码示例来源:origin: apache/activemq

protected void tearDown() throws Exception {
  super.tearDown();
  // Stops the auto fail thread only after performing any clean up
  stopAutoFailThread();
}

代码示例来源:origin: apache/hive

@Override
protected void tearDown() throws Exception {
 try {
  super.tearDown();
  client.close();
 } catch (Throwable e) {
  System.err.println("Unable to close metastore");
  System.err.println(StringUtils.stringifyException(e));
  throw new Exception(e);
 }
}

代码示例来源:origin: apache/hive

@Override
protected void tearDown() throws Exception {
 try {
  super.tearDown();
  client.dropTable(dbName, tblName);
  client.dropDatabase(dbName);
  client.close();
 } catch (Throwable e) {
  LOG.error("Unable to close metastore", e);
  throw new Exception(e);
 }
}

相关文章