<commit_before>juniter
=======

Framework that extends JUnit functionality. Adds alternative approach for test
rules, automatic mocking, context creation in guice and reflection assert
utilities. The project juniter uses [semantic versioning](http://semver.org/)
and tagging to provide clean version numbers.

Test life cycle
---------------

Test life cycle `org.eluder.juniter.core.TestLifeCycle` provides the hooks to
different phases of a unit test. The main reason for custom interface over the
JUnit `org.junit.rules.TestRule` interface is that the test rules do not allow
access to the test instance.

Comparison between the TestLifeCycle and TestRule interfaces:

<table>
  <tr>
    <td></td>
    <td><strong>TestLifeCycle</strong></td>
    <td><strong>TestRule</strong></td>
  </tr>
  <tr>
    <td>Easy access to test instance</td>
    <td>yes</td>
    <td>no</td>
  </tr>
  <tr>
    <td>Easy access to test class</td>
    <td>yes</td>
    <td>yes</td>
  </tr>
  <tr>
    <td>Easy access to test method</td>
    <td>yes</td>
    <td>no</td>
  </tr>
  <tr>
    <td>Must reset its own state after each test</td>
    <td>no</td>
    <td>yes</td>
  </tr>
  <tr>
    <td>Requires a custom JUnit runner</td>
    <td>yes</td>
    <td>no</td>
  </tr>
</table>


Usage
-----

Core module requires the following dependency:

```xml
<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-core</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>
```

Using test life cycles requires defining the juniter test runner and defining
the life cycles to use:

```java
@RunWith(TestRunner.class)
@TestLifeCycles({ FirstLifeCycle.class, SecondLifeCycle.class })
public class MyTest {
    ...
}
```

Automatic mocking can be achieved with the shorthand mock runner or defining
the mock life cycle as one test life cycle:

```java
@RunWith(MockTestRunner.class)
public class MockTest {
    ...
}
```

is equivalent to

```java
@RunWith(TestRunner.class)
@TestLifeCycles({ MockLifeCycle.class })
public class MockTest {
    ...
}
```
Guice integration requires the following dependency:

```xml
<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-guice</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>
```


Continuous integration
----------------------

Travis CI builds juniter with Oracle JDK 7 and OpenJDK 6.
https://travis-ci.org/trautonen/juniter

[![Build Status](https://travis-ci.org/trautonen/juniter.png?branch=develop)](https://travis-ci.org/trautonen/juniter)


License
-------

The project juniter is licensed under the MIT license.<commit_msg>Readme cleanup.<commit_after>juniter
=======

Framework that extends JUnit functionality. Adds alternative approach for test
rules, automatic mocking, context creation in guice and reflection assert
utilities. The project juniter uses [semantic versioning](http://semver.org/)
and tagging to provide clean version numbers.

Test life cycle
---------------

Test life cycle `org.eluder.juniter.core.TestLifeCycle` provides the hooks to
different phases of a unit test. The main reason for custom interface over the
JUnit `org.junit.rules.TestRule` interface is that the test rules do not allow
access to the test instance.

Comparison between the TestLifeCycle and TestRule interfaces:

<table>
  <tr>
    <td></td>
    <td><strong>TestLifeCycle</strong></td>
    <td><strong>TestRule</strong></td>
  </tr>
  <tr>
    <td>Easy access to test instance</td>
    <td>yes</td>
    <td>no</td>
  </tr>
  <tr>
    <td>Easy access to test class</td>
    <td>yes</td>
    <td>yes</td>
  </tr>
  <tr>
    <td>Easy access to test method</td>
    <td>yes</td>
    <td>no</td>
  </tr>
  <tr>
    <td>Must reset its own state after each test</td>
    <td>no</td>
    <td>yes</td>
  </tr>
  <tr>
    <td>Requires a custom JUnit runner</td>
    <td>yes</td>
    <td>no</td>
  </tr>
</table>


Usage
-----

Core module requires the following dependency:

```xml
<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-core</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>
```

Using test life cycles requires defining the juniter test runner and defining
the life cycles to use:

```java
@RunWith(TestRunner.class)
@TestLifeCycles({ FirstLifeCycle.class, SecondLifeCycle.class })
public class MyTest {
    ...
}
```

Automatic mocking can be achieved with the shorthand mock runner or defining
the mock life cycle as one test life cycle:

```java
@RunWith(MockTestRunner.class)
public class MockTest {
    ...
}
```

is equivalent to

```java
@RunWith(TestRunner.class)
@TestLifeCycles({ MockLifeCycle.class })
public class MockTest {
    ...
}
```
Guice integration requires the following dependency:

```xml
<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-guice</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>
```


Continuous integration
----------------------

Travis CI builds juniter with Oracle JDK 7 and OpenJDK 6.

https://travis-ci.org/trautonen/juniter

[![Build Status](https://travis-ci.org/trautonen/juniter.png?branch=develop)](https://travis-ci.org/trautonen/juniter)


License
-------

The project juniter is licensed under the MIT license.
{'fraction_non_alphanumeric': 0.14644829556274996, 'fraction_numerical': 0.00304703865930299, 'mean_word_length': 3.5669565217391304, 'pattern_counts': {'":': 0, '<': 143, '<?xml version=': 0, '>': 143, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2030061', 'n_tokens_mistral': 1815, 'n_tokens_neox': 1708, 'n_words': 500}