Skip to content

Commit c0e3019

Browse files
author
Piotr Joński
authored
Merge pull request #136 from sta-szek/#113-Testing-constructors
#113. Constructor testing
2 parents b9bda55 + 2edb2fa commit c0e3019

File tree

270 files changed

+78916
-40537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+78916
-40537
lines changed

build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ static def gitUser() {
164164
username + " " + useremail
165165
}
166166

167-
assemble.dependsOn javadoc
168167
check.dependsOn jacocoTestReport
169168
build.dependsOn publishToMavenLocal
170169

docs/comparison/README.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Here you can compare pojo-tester to existing java libraries that test `pojo-meth
44
## Other libraries {#other-libs}
55
Here is the list of libraries that were found on the Internet. If you find another one, feel free to write a comparison and include it into your pull request.
66

7-
* pojo-tester 0.4.0
7+
* pojo-tester 0.5.0
88
* [openpojo](http://openpojo.com) 0.8.4
99
* [SmartUnit](https://github.com/rlogiacco/SmartUnit) 0.10.2
1010
* [testUtils](http://outsidemybox.github.io/testUtils/index.html) 0.1.3
@@ -40,26 +40,27 @@ Each library provides different testing features. Here is the comparison.
4040

4141
Basic `pojo-methods` test support:
4242

43-
| Kind of tests | pojo-tester | OpenPojo | SmartUnit | testUtils | testUtil | Mean Bean |
44-
|--- |:---: |:---: |:---: |:---: |:---: |:---: |
45-
| getters | &#10003 | &#10003 | &#10003^ | &#10003 | &#10003^ | &#10003 |
46-
| setters | &#10003 | &#10003 | &#10003^ | &#10003 | &#10003^ | &#10003 |
47-
| equals | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10003^ |
48-
| hashCode | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10003^ |
49-
| toString | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10005 |
50-
|||||||||
51-
| Additional features ||
43+
| Kind of tests | pojo-tester | OpenPojo | SmartUnit | testUtils | testUtil | Mean Bean |
44+
|--- |:---: |:---: |:---: |:---: |:---: |:---: |
45+
| getters | &#10003 | &#10003 | &#10003^ | &#10003 | &#10003^ | &#10003 |
46+
| setters | &#10003 | &#10003 | &#10003^ | &#10003 | &#10003^ | &#10003 |
47+
| equals | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10003^ |
48+
| hashCode | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10003^ |
49+
| toString | &#10003 | &#10003*^ | &#10005 | &#10003 | &#10005 | &#10005 |
50+
| constructors | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 | &#10005 |
51+
||||||||
52+
| Additional features |
5253
| field selection | &#10003 | &#10003 | &#10003 | &#10003 | &#10005 | &#10003 |
5354
| method selection | &#10003 | &#10003 | &#10005 | &#10005 | &#10005 | &#10003 |
5455
| supports nonpublic classes | &#10003 | &#10003 | &#10005 | &#10003 | &#10005 | &#10005 |
5556
| supports non-default constructors | &#10003 | &#10003 | &#10005 | &#10003 | &#10005 | &#10005 |
5657
| recurrence support | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 | &#10005 |
5758
| creating object by user defined constructor | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 | &#10005 |
5859
| custom changing fields values | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 | &#10005 |
59-
| package-testing | &#10005 | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 |
60+
| package-testing | &#10003 | &#10003 | &#10005 | &#10005 | &#10005 | &#10005 |
6061

6162
\* limited support for changing fields recursively and otherwise having problems with fields other than primitives.
62-
Libraries throw exceptions from java core, which does mean nothing.
63+
6364
^ requires additional changes in your production code
6465

6566
### Tests
@@ -280,9 +281,6 @@ And there is one more thing. Tests (internal, in library implementation) using M
280281
`POJO-TESTER` does the job. It provides stable coverage with the highest percentage. See numbers below.
281282
![](coverage-comparison.png)
282283

283-
Next thing that `POJO-TESTER` can do, but other libraries cannot, is recursively testing fields.
284-
This means your tests are more sure.
285-
286284
We have done one more code coverage report using changing nested fields.
287285
From those tests we excluded three libraries - Mean Bean, Smart Unit and TestUtil.
288286
They simply could not perform such tests and threw undefined exceptions.
@@ -316,4 +314,11 @@ Disadvantages are:
316314
* it has variable coverage report, which can cause unwanted CI reports
317315
* it does not support recurrence which can be a deal breaker, especially if you use enums or VOs (Value Objects)
318316

317+
Next thing that `POJO-TESTER` can do, but other libraries cannot, is recursively testing fields.
318+
This means your tests are more sure.
319+
320+
And last but not least which makes `POJO-TESTER` awesome is that it can test constructors!
321+
Now you can forget about getting constructors via reflection, invoking them... What a nightmare. And who is doing this?
322+
No more reflection in your tests!
323+
319324
To sum up, `POJO-TESTER` has the highest consistent coverage and its features make your tests more bulletproof.

0 commit comments

Comments
 (0)