-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d74eb7e
commit efe8bd6
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# dagger-plugin-processor | ||
Annotation processor to help with the <a href="https://github.com/Madrapps/dagger-plugin">dagger-plugin</a> project. This project is | ||
to be used exclusively on | ||
|
||
Spec | ||
----- | ||
|
||
`@GenerateTest` | ||
- `directory` => The root directory that contains the test case folders | ||
- `exclude ` => List of directories to exclude in the annotation processing | ||
|
||
Example | ||
----- | ||
|
||
``` | ||
@GenerateTest(directory = "inject", exclude = ["assets"]) | ||
abstract class InjectTestCase : BaseTestCase("inject") | ||
``` | ||
|
||
``` | ||
testData | ||
|_inject | ||
|_assets | ||
|_AbstractClass | ||
|_AbstractClass.java | ||
|_ConcreteClass.java | ||
|_KSuccessComponent.kt | ||
|_KFailureComponent.kt | ||
|_FinalFields | ||
|_ClassWithFinalField.java | ||
|_ClassWithNonFinalField.java | ||
|_KFailureComponent.kt | ||
|_KSuccessComponent.kt | ||
``` | ||
|
||
The above config will generate the following Test files under `build/generated/source/kapt/test/...` directory: | ||
``` | ||
package com.madrapps.dagger | ||
class AbstractClass : InjectTestCase() { | ||
fun testKFailureComponent() = testValidation() | ||
fun testConcreteClass() = testValidation() | ||
fun testAbstractClass() = testValidation() | ||
fun testKSuccessComponent() = testValidation() | ||
} | ||
``` | ||
``` | ||
package com.madrapps.dagger | ||
class FinalFields : InjectTestCase() { | ||
fun testClassWithFinalField() = testValidation() | ||
fun testKFailureComponent() = testValidation() | ||
fun testKSuccessComponent() = testValidation() | ||
fun testClassWithNonFinalField() = testValidation() | ||
} | ||
``` |