GitHub user johnma14 opened a pull request: https://github.com/apache/kafka/pull/3589
KAFKA-3623: KStreamTestDriver extends ExternalResource In the streams project, there are a number of unit tests that has duplicate code with respect to the tearDown() method, in which it tries to close the KStreamTestDriver connection. The goal of this changeset is to eliminate this duplication by converting the KStreamTestDriver class to an ExternalResource class which is the base class of JUnit Rule. In every unit tests that calls KStreamTestDriver, we annotate the KStreamTestDriver using @Rule annotation. In the KStreamTestDriver class, we override the after() method. This after() method in turn calls the close() method which was previously called in the tearDown() method in the unit tests. By annotating the KStreamTestDriver as a @Rule, the after() method will be called automatically after every testcase. You can merge this pull request into a Git repository by running: $ git pull https://github.com/johnma14/kafka bug/KAFKA-3623 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3589.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3589 ---- commit 3fb1cd54f507ac35cb0fb64677c9ad386ad89b3e Author: johnma14 <mari...@us.ibm.com> Date: 2017-07-15T08:42:23Z KAFKA-3623: KStreamTestDriver extends ExternalResource In the streams project, there are a number of unit tests that has duplicate code with respect to the tearDown() method, in which it tries to close the KStreamTestDriver connection. The goal of this changeset is to eliminate this duplication by converting the KStreamTestDriver class to an ExternalResource class which is the base class of JUnit Rule. In every unit tests that calls KStreamTestDriver, we annotate the KStreamTestDriver using @Rule annotation. In the KStreamTestDriver class, we override the after() method. This after() method in turn calls the close() method which was previously called in the tearDown() method in the unit tests. By annotating the KStreamTestDriver as a @Rule, the after() method will be called automatically after every testcase. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---