https://github.com/palatable/traitor
Trait testing in JUnit
https://github.com/palatable/traitor
Last synced: 5 months ago
JSON representation
Trait testing in JUnit
- Host: GitHub
- URL: https://github.com/palatable/traitor
- Owner: palatable
- License: mit
- Created: 2014-02-28T22:30:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-10-23T01:15:30.000Z (over 6 years ago)
- Last Synced: 2025-08-03T05:17:10.584Z (11 months ago)
- Language: Java
- Size: 35.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
traitor [](https://travis-ci.org/palatable/traitor)
=======
Trait testing with JUnit.
installation
------------
Add the following dependency to your `pom.xml` file:
```xml
com.jnape.palatable
traitor
1.0
```
usage
-----
An example test suite that tests traits alongside unit tests might look like:
```Java
@RunWith(Traits.class)
public class FunctionalIterableTest {
@Test
public void mapsFunctionOverValues() {
//...
}
@TestTraits({Laziness.class, StandardIteration.class})
public FunctionalIterable createTestSubject() {
return FunctionalIterable.iterable(1, 2, 3, 4, 5);
}
}
```
```Java
public class Laziness implements Trait {
@Override
public void test(FunctionalIterable testSubject) {
//use normal JUnit asserts here
}
//same goes for StandardIteration
}
```
Note that the Traits runner simply requires the existence of at least @Test method or @TestTrait method in your test suite.
running
-------
Traitor can be run the same way you run JUnit - typically in your IDE or using your build tool (Maven, Gradle, Ant, etc.). Any test suites that use the `Traits` runner will automatically work.
license
-------
_traitor_ is part of [palatable](http://www.github.com/palatable), which is distributed under [The MIT License](http://choosealicense.com/licenses/mit/).