https://github.com/int02h/ocubator
Tool for testing Java annotation processors
https://github.com/int02h/ocubator
annotation-processing annotation-processor java testing testing-tools
Last synced: 3 months ago
JSON representation
Tool for testing Java annotation processors
- Host: GitHub
- URL: https://github.com/int02h/ocubator
- Owner: int02h
- License: mit
- Created: 2018-12-09T08:19:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-07T08:17:13.000Z (over 6 years ago)
- Last Synced: 2025-09-15T07:44:07.301Z (3 months ago)
- Topics: annotation-processing, annotation-processor, java, testing, testing-tools
- Language: Java
- Size: 80.1 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ocubator
[](https://github.com/int02h/ocubator/releases/latest)
[](https://travis-ci.com/int02h/ocubator)
[](https://coveralls.io/github/int02h/ocubator?branch=master)
Ocubator is very polite tool for testing Java annotation processors. Just say `please` and it will do everything you want.
This library is inspired by Google's [compile-testing](https://github.com/google/compile-testing) but allows you not only check the source code of generated classes but also create instances of them. It looks more logical to test class behaviour like in the familiar unit testing instead of verifying that annotation processor has generated expected source code. That's the idea.
Here's the example of the single source code compilation with one annotation processor:
```java
CompilationResult result = OcubatorCompiler.compile()
.sourceCode(
"import com.dpforge.ocubator.TestAnnotation;",
"@TestAnnotation",
"class Foo {}")
.withProcessor(new TestProcessor())
.please();
assertTrue(result.isSuccess());
```
Note that you don't need to provide qualified class name or any file name at all. Ocubator will automatically extracts it from provided the source code.
Download
--------
Get the latest version of the Ocubator library with Maven
```xml
com.dpforge
ocubator
1.3.1
```
or Gradle
```groovy
compile 'com.dpforge:ocubator:1.3.1'
```
License
-------
Copyright (c) 2019 Daniil Popov
Licensed under the [MIT](LICENSE) License.