-
Notifications
You must be signed in to change notification settings - Fork 0
Version1 in English
You may get an error if you upgrade to 1.1.7+.
Because assertjGenerator
configuration was removed for bugfix #12.
Please configure assertjGenerator
at assertjGenPreConfig
instead.
your build.gradle
ext {
+ assertjGenPreConfig = [
+ "assertjGenerator": "xxx"
+ ]
}
assertjGen {
- assertjGenerator = 'xxx'
}
See Gradle - Plugin: com.github.opengl-BOBO.assertjGen
This plugin add assertjGen
task.
This task generates Assertion Classes by AssertJ Assertions Generator.
build.gradle
buildscript {
...
}
apply plugin: 'java'
// You must declare a custom 'sourceSets' configuration before include 'assertjGen' plugin.
// Because, 'assertjGen' plugin needs to read 'sourceSets' at it was loaded.
sourceSets {
foo.java.srcDirs { "src/main/foo" }
bar.java.srcDirs { "src/main/bar" }
}
ext {
// This property must be declared before to apply plugin ("apply plugin: 'com.github.opengl-BOBO.assertjGen'").
// Because assertjGen plugin needs read these options before define tasks.
assertjGenPreConfig = [
// specify AssertJ Assertions Generator dependency. (default is ver 2.0.0)
'assertjGenerator': 'org.assertj:assertj-assertions-generator:2.0.0',
// specify sourceSets names. (default is ['main'])
'sourceSets': ['main', 'foo', 'bar']
]
}
apply plugin: 'com.github.opengl-BOBO.assertjGen'
repositories {
// Plugin uses an 'assertj-assertions-generator' module.
// Therefore specified repository must have the module.
mavenCentral()
}
assertjGen {
// specify target class or package names by array. (defailt is empty array)
classOrPackageNames = ['foo.bar']
// specify output dir(String path or File object). (default is 'src/test/java-gen')
outputDir = 'src/test/foo-bar'
}
At least you must set classOrPackageNames
option.
If you want output files into a directory that includes handmade files (e.g. src/test/java
), please set cleanOnlyFiles
option to true
.
assertjGen {
classOrPackageNames = ['foo.bar']
outputDir = 'src/test/java'
cleanOnlyFiles = true
}
If cleanOnlyFiles
option is false
(default is false
), assertjClean
task deletes all files under an outputDir
.
So handmade files will be deleted.
If cleanOnlyFiles
option is true
, assertjClean
task only deletes matched files by cleanFilesPattern
option.
cleanFilesPattern
option is regular expression. Its default value is /^.*Assert\.java$/
.
This task generates assertion classes.
compileTestJava
-> assertjGen
-> assertjClean
and compileJava
So you run test
task, then assertjGen
task is also run.
This task deletes generated classes (*.java
files).
If you run clean
task, then assertjClean
task is also run.
- v1.1.8 (2017-10-05)
- Bugfix #17
- v1.1.7 (2017-09-11)
-
v1.1.5, v1.1.6- These two versions are unavailable because I failed to publish plugin.
- v1.1.4 (2017-07-08)
- Bugfix #8
- v1.1.3 (2017-04-29)
- v1.1.2 (2017-02-12)
- v1.1.1 (2017-01-29)
- Removed
Task.leftShift
(Closure) deprecation warning.
- Removed
- v1.1.0 (2016-10-15)
- Add
cleanOnlyFiles
andcleanFilesPattern
options.
- Add
- v1.0.0
- First Release
You may get an error if you upgrade to 1.1.4+.
Because repositories
configuration was removed for bugfix #8.
AssertjGen.groovy
- project.repositories {
- mavenCentral()
- }
Therefore Gradle will lose a repositories
configuration, if you had not configured repositories
and upgrade to 1.1.4+.
Please configure repositories
explicitly.
your build.gradle
+ repositories {
+ mavenCentral()
+ }