https://github.com/centic9/commons-test
Utilitity library for testing stuff that I use in multiple projects
https://github.com/centic9/commons-test
compare equals hashcode java junit mocking testing
Last synced: 6 months ago
JSON representation
Utilitity library for testing stuff that I use in multiple projects
- Host: GitHub
- URL: https://github.com/centic9/commons-test
- Owner: centic9
- License: bsd-2-clause
- Created: 2015-04-30T19:13:52.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-05T08:18:39.000Z (6 months ago)
- Last Synced: 2025-04-05T08:27:31.494Z (6 months ago)
- Topics: compare, equals, hashcode, java, junit, mocking, testing
- Language: Java
- Size: 539 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/centic9/commons-test/actions)
[](https://gradleupdate.appspot.com/centic9/commons-test/status)
[](https://github.com/centic9/commons-test/releases)
[](https://github.com/centic9/commons-test/releases/latest)
[](https://github.com/centic9/commons-test/tags)
[](https://maven-badges.herokuapp.com/maven-central/org.dstadler/commons-test)
[](https://maven-badges.herokuapp.com/maven-central/org.dstadler/commons-test)This is a small library of code-pieces that I find useful when writing tests.
It covers areas that I miss in JUnit itself e.g. for verifying compare()/hashCode()/equals() implementations and for multi-threaded tests.
## Contents
* MockSMTPServer - simulate an SMTP Server for testing code which sends emails
* MockRESTServer - simulate a HTTP Server for testing code which accesses other systems, e.g. to mock REST interfaces in tests
* TestHelpers - small utilities for testing things like equals(), hashCode(), toString(), compare() and implementations of Comparator, they ensure some things that the Java spec mandates
* ThreadTestHelpers - easily run unit tests multiple times in parallel to ensure the code does not contain hidden race conditions
* MemoryLeakVerifier - a simple way of adding memory leak assertions to unit tests
* TestEnvironment - handling temporary files/directories in a clean way, ensure that files are not locked any more at the end of the test
* PrivateConstructorCoverage - use this if you would like to get 100% coverage of classes with private constructors
* HeapDump - trigger a writing a .hprof file## Use it
### Gradle
compile 'org.dstadler:commons-test:1.+'
## Change it
### Grab it
git clone https://github.com/centic9/commons-test.git
### Build it and run tests
cd commons-test
./gradlew check jacocoTestReport### Release it
./gradlew --console=plain release && ./gradlew closeAndReleaseRepository
* This should automatically release the new version on MavenCentral
* Afterwards go to the [Github releases page](https://github.com/centic9/commons-test/releases) and add release-notes## Support this project
If you find this library useful and would like to support it, you can [Sponsor the author](https://github.com/sponsors/centic9)
## Licensing
* commons-test is licensed under the [BSD 2-Clause License].
* A few pieces are imported from other sources, the source-files contain the necessary license pieces/references.[BSD 2-Clause License]: https://www.opensource.org/licenses/bsd-license.php