Java Code Examples for org.junit.After

The following are top voted examples for showing how to use org.junit.After. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to product more good examples.

Example 1
Project: lettuce   File: ScriptingCommandTest.java View source code Vote up 7 votes
@After
public void closeConnection() throws Exception {
    try {
        redis.scriptKill();
    } catch (RedisException e) {

    }
    super.closeConnection();
}
 
Example 2
Project: jena   File: TestIndexingSpatialDataWithSolr.java View source code Vote up 7 votes
@After
public void destroy() {
	SpatialIndexSolr index = (SpatialIndexSolr) dataset.getContext().get(
			SpatialQuery.spatialIndex);
	index.getServer().shutdown();
	SpatialSearchUtil.deleteOldSolrDataDir();
}
 
Example 3
Project: AIDR   File: TestNominalLabelResourceFacadeImp.java View source code Vote up 6 votes
@After
public void tearDown() {
	try {
		if (nominalLabel != null) {
			entityManager.getTransaction().begin();
			nominalLabelResourceFacadeImp.deleteNominalLabel(nominalLabel);
			entityManager.getTransaction().commit();
			nominalLabel=null;
		}
	} catch (PropertyNotSetException e) {
		logger.error("PropertyNotSetException while deleting nominal label "+e.getMessage());
		fail("tearDown failed");
	}
}
 
Example 4
Project: k3po   File: RobotScriptLexerTest.java View source code Vote up 6 votes
@After
public void tearDown() throws Exception {

    if (scriptFile != null) {
        scriptFile.delete();
        scriptFile = null;
    }
}
 
Example 5
Project: ExpectIt   File: ProcessTest.java View source code Vote up 6 votes
@After
public void cleanup() throws IOException, InterruptedException {
    if (process != null) {
        process.destroy();
        process.waitFor();
    }
    if (expect != null) {
        expect.close();
    }
    LoggingExample.disableLogging(handler);
}
 
Example 6
Project: SharkFW   File: SQKKBTests.java View source code Vote up 6 votes
@After
public void tearDown() {
    try {
        this.sqkKB.drop();
        this.sqkKB.close();
    } catch (SharkKBException ex) {
        // ignore
    }
}
 
Example 7
Project: junit-dataprovider   File: DataProviderRunner.java View source code Vote up 6 votes
/**
 * [email protected]}
 * <p>
 * Is copied from [email protected] BlockJUnit4ClassRunner#validateInstanceMethods} because [email protected] #computeTestMethods()} must
 * not be called if validation already found errors!
 */
@Override
@Deprecated
protected void validateInstanceMethods(List<Throwable> errors) {
    validatePublicVoidNoArgMethods(After.class, false, errors);
    validatePublicVoidNoArgMethods(Before.class, false, errors);
    validateTestMethods(errors);

    if (errors.isEmpty() && computeTestMethods().size() == 0) {
        errors.add(new Exception("No runnable methods"));
    }
}
 
Example 8
Project: eis   File: LangHashCodeEqualsTest.java View source code Vote up 6 votes
@After
public void tearDown() throws Exception {
	perceptB = null;
	actionB = null;
	functionB = null;
	numeralB = null;
	identifierB = null;

	perceptA = null;
	actionA = null;
	functionA = null;
	numeralA = null;
	identifierA = null;

}
 
Example 9
Project: oncue   File: ActorSystemTest.java View source code Vote up 6 votes
@After
public void stopActorSystem() throws Exception {
	system.shutdown();
	if (waitForRunningJobs) {
		while (!system.isTerminated()) {
			log.debug("Waiting for system to shut down...");
			Thread.sleep(500);
		}
	}
	log.debug("System shut down");
}
 
Example 10
Project: dswarm-graph-neo4j   File: Neo4jRunningDBWrapper.java View source code Vote up 6 votes
@After
public void tearDown() {

	// TODO: we may need to remove this and replace this with a more precise delete method

	LOG.debug("clean-up DB after test has finished");

	final ClientResponse response = service().path("/maintain/delete").delete(ClientResponse.class);

	Assert.assertEquals("expected 200", 200, response.getStatus());
}
 
Example 11
Project: arquillian-showcase   File: DefaultStockServiceTestCase.java View source code Vote up 6 votes
/**
 * <p>Tears down the test environment.</p>
 *
 * @throws Exception if any error occurs
 */
@After
public void tearDown() throws Exception {

    // deletes all records from database
    runScript(jdbcTemplate, "delete.sql");
}
 
Example 12
Project: junixsocket   File: BufferOverflowTest.java View source code Vote up 6 votes
@After
public void teardown() {
  try {
    if (server != null) {
      server.close();
    }
  } catch (IOException e) {
    // ignore
  }

  if (executor != null) {
    executor.shutdown();
  }
}
 
Example 13
Project: metrics   File: ElasticSearchHostRegistryTest.java View source code Vote up 6 votes
@After
public void tearDown() {
    _repository.close();
    try {
        FileUtils.deleteDirectory(_tempDirectory);
    } catch (final IOException ioe) {
        // Do nothing
    }
}
 
Example 14
Project: Original---remoting-jmx-   File: NotificationServerSideTest.java View source code Vote up 6 votes
@After
public void unregister() throws Exception {
    if (mbeanServer.isRegistered(notificationName)) {
        mbeanServer.unregisterMBean(notificationName);
    }
    if (mbeanServer.isRegistered(listenerName)) {
        mbeanServer.unregisterMBean(listenerName);
    }
    connection = null;
}
 
Example 15
Project: aws-sdk-android   File: FileRecordStoreTest.java View source code Vote up 6 votes
@After
public void teardown() {
    if (TEST_DIRECTORY.exists()) {
        for (File topLevel : TEST_DIRECTORY.listFiles()) {
            for (File file : topLevel.listFiles()) {
                assertTrue(file.delete());
            }
            assertTrue(topLevel.delete());
        }
        assertTrue(TEST_DIRECTORY.delete());
    }
}
 
Example 16
Project: reactor   File: TcpClientTests.java View source code Vote up 6 votes
@After
public void cleanup() throws InterruptedException, IOException {
	echoServer.close();
	abortServer.close();
	timeoutServer.close();
	heartbeatServer.close();
	threadPool.shutdown();
	threadPool.awaitTermination(5, TimeUnit.SECONDS);
	Thread.sleep(500);
}
 
Example 17
Project: elasticsearch-cloud-aws   File: AbstractAwsTest.java View source code Vote up 6 votes
@After
public void restoreProperties() {
    for (String p : AWS_INVARIANT_PROPERTIES) {
        if (properties.get(p) != null) {
            System.setProperty(p, properties.get(p));
        } else {
            System.clearProperty(p);
        }
    }
}
 
Example 18
Project: FireflowEngine20   File: BaseWebappTest.java View source code Vote up 6 votes
@After
public void shutdownServer() throws Throwable {
    if (!isRunInMaven) {
        if (server != null)
            server.stop();
    }
}
 
Example 19
Project: cmpt   File: LogTest.java View source code Vote up 6 votes
@After
public void tearDown() throws Exception
{
	File logTest = new File(logFile);
	if (logTest.exists())
	{
		logTest.delete();
	}
}
 
Example 20
Project: Infinitum-Core   File: XmlContextFactoryTest.java View source code Vote up 6 votes
@After
public void tearDown() {
    contextFactory.clearConfiguration();
    try {
        inputStream.close();
    } catch (IOException e) {
    }
}