https://github.com/yvanmazy/concurrent-testing
Minimal Java library to create concurrency tests.
https://github.com/yvanmazy/concurrent-testing
concurrency java lightweight unit-testing
Last synced: about 1 year ago
JSON representation
Minimal Java library to create concurrency tests.
- Host: GitHub
- URL: https://github.com/yvanmazy/concurrent-testing
- Owner: YvanMazy
- Created: 2024-03-28T17:49:35.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T13:27:17.000Z (almost 2 years ago)
- Last Synced: 2025-02-09T07:45:16.733Z (over 1 year ago)
- Topics: concurrency, java, lightweight, unit-testing
- Language: Java
- Homepage:
- Size: 77.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: .github/README.md
Awesome Lists containing this project
README
# 🧵 concurrent-testing
Very small Java library for doing concurrency tests during unit testing. It's a tool that I use for personal projects,
it is not intended to be really maintained.
Here is a small example of use:
```java
@RepeatedTest(10) // To reduce randomness, use repeated test
void testAtomicCounter() {
final Counter counter = new AtomicCounter();
ConcurrentTester.run(() -> {
// Code executed in different threads
counter.increment();
}, c -> c.threads(THREADS).iterations(ITERATIONS));
assertEquals(THREADS * ITERATIONS, counter.get());
}
```
To use the project as a dependency, you can add it using [Maven](https://maven.apache.org/)
or [Gradle](https://gradle.org/).
**Last version**: [](https://jitpack.io/#YvanMazy/concurrent-testing)
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.YvanMazy:concurrent-testing:VERSION'
}
```
```xml
jitpack.io
https://jitpack.io
com.github.YvanMazy
concurrent-testing
VERSION
```