-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathassertj-assertions-generator-maven-plugin.html
716 lines (589 loc) · 38.5 KB
/
assertj-assertions-generator-maven-plugin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="AssertJ site">
<meta name="author" content="Joel Costigliola">
<title>AssertJ / Fluent assertions for java</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Inconsolata|Source+Code+Pro|Open+Sans|Ubuntu|Varela+Round|Karla">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
<script src="highlight/highlight.pack.js"></script>
<link rel="stylesheet" href="highlight/styles/railscasts.css">
<script>hljs.initHighlightingOnLoad();</script>
<link href="css/assertj.min.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.png" />
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- You'll want to use a responsive image option so this logo looks good on devices - I recommend using something like retina.js (do a quick Google search for it and you'll find it) -->
<a class="navbar-brand" href="index.html">AssertJ</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="assertj-core-quick-start.html">Quick start</a></li>
<li><a href="assertj-news.html">News</a></li>
<li><a href="assertj-core.html">Core</a></li>
<li><a href="assertj-assertions-generator.html">Assertions generator</a></li>
<li><a href="assertj-guava.html">Guava</a></li>
<li><a href="assertj-joda-time.html">Joda-Time</a></li>
<li><a href="assertj-db.html">DB</a></li>
<li><a href="assertj-neo4j.html">Neo4j</a></li>
<li><a href="assertj-swing.html">Swing</a></li>
<li><a href="assertj-help.html">Help</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-2 assertj-sidebar-menu">
<div class="bs-sidebar hidden-print affix-top" role="complementary">
<ul class="bs-sidenav nav ">
<li class="sidenav-header">Assertions generator</li>
<li><a href="assertj-assertions-generator.html">Overview</a></li>
<li><a href="assertj-assertions-generator.html#philosophy">Philosophy</a></li>
<li><a href="assertj-assertions-generator.html#generated-assertions">Created assertions</a></li>
<li><a href="assertj-assertions-generator.html#generated-entry-points">Created entry points</a></li>
<li><a href="assertj-assertions-generator.html#generated-assertions-templates">Assertion templates</a></li>
<li><a href="assertj-assertions-generator.html#quickstart">Quick start</a></li>
<li><a href="assertj-assertions-generator.html#news">News & releases</a></li>
<li><a href="assertj-assertions-generator.html#mailing-list">Mailing list</a></li>
<li><a href="assertj-assertions-generator.html#code">Code & issues <i class="fa fa-github"></i></a></li>
<li><a href="assertj-assertions-generator.html#contributing">Contributing</a></li>
<li class="sidenav-header">Maven plugin</li>
<li><a href="assertj-assertions-generator-maven-plugin.html">Overview</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#quickstart">Quick start</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#configuration">Configuration</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#custom-templates">Custom templates</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#news">News & releases</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#mailing-list">Mailing list</a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#code">Code & issues <i class="fa fa-github"></i></a></li>
<li><a href="assertj-assertions-generator-maven-plugin.html#contributing">Contributing</a></li>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-10 col-sm-10 text-left">
<h1 class="page-header">AssertJ assertions generator maven plugin</h1>
<p>This maven plugin generates AssertJ assertions specific to your own classes, it's a wrapper of the <a href="assertj-assertions-generator.html">AssertJ Assertions Generator</a>.</p>
<p>Starting with version 2.0, users can now <a href="#custom-templates">customize generated assertions</a> by using their own templates.</p>
<p>Big thanks to <a href="https://github.com/mostr"><span class="contributor">Michal Ostruszka</span></a> for his major contributions to this plugin.</p>
<h3 class="page-header"><span id="quickstart"></span>Quickstart</h3>
<p>You need to configure your project <span class="small-code">pom.xml</span> in order to use the maven assertions generator plugin.</p>
<h4 class="page-header">1 - Add AssertJ Core dependency to your pom.xml</h4>
<pre><code class="xml"><dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<!-- use version 2.1.0 or higher -->
<version>2.1.0</version>
<scope>test</scope>
</dependency></code></pre>
<h4 class="page-header">2 - Configure the plugin in the build/plugins section of your pom.xml</h4>
<p>To generate custom assertions, add the following plugin to your <span class="small-code">pom.xml</span> :</p>
<pre><code class="xml"><plugin>
<groupId>org.assertj</groupId>
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<packages>
<param>your.first.package</param>
<param>your.second.package</param>
</packages>
<classes>
<param>your.third.package.YourClass</param>
</classes>
</configuration>
</plugin></code></pre>
<h4 class="page-header">3 - Launch the maven plugin</h4>
<p>Execute the command :</p>
<pre><code class="bash">mvn assertj:generate-assertions</code></pre>
<p>By default, assertions are generated in the <span class="small-code">target/generated-test-sources/assertj-assertions/</span> folder.</p>
<p>Execution example in <a href="https://github.com/joel-costigliola/assertj-examples/">assertj-examples</a> project :</p>
<pre><code class="bash">====================================
AssertJ assertions generation report
====================================
--- Generator input parameters ---
The following templates will replace the ones provided by AssertJ when generating AssertJ assertions :
- Using custom template for 'object assertions' loaded from ./templates/my_has_assertion_template.txt
- Using custom template for 'hierarchical concrete class assertions' loaded from ./templates/my_assertion_class_template.txt
Generating AssertJ assertions for classes in following packages and subpackages:
- org.assertj.examples.data
Input classes excluded from assertions generation:
- org.assertj.examples.data.MyAssert
--- Generator results ---
Directory where custom assertions files have been generated :
- /assertj/assertj-examples/assertions-examples/target/generated-test-sources/assertj-assertions
# full path truncated for to improve clarity in the website.
Custom assertions files generated :
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/AlignmentAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/BasketBallPlayerAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/BookAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/BookTitleAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/EmployeeAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/EmployeeTitleAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/MagicalAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/MansionAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/NameAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/PersonAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/RaceAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/RingAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/TeamAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/TolkienCharacterAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/movie/MovieAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/neo4j/DragonBallGraphAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/service/GameServiceAssert.java
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/service/TeamManagerAssert.java
No custom assertions files generated for the following input classes as they were not found:
- com.fake.UnknownClass1
- com.fake.UnknownClass2
Assertions entry point class has been generated in file:
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/Assertions.java
Soft Assertions entry point class has been generated in file:
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/SoftAssertions.java
JUnitSoftAssertions entry point class has been generated in file:
- .../generated-test-sources/assertj-assertions/org/assertj/JUnitSoftAssertions.java
BDD Assertions entry point class has been generated in file:
- .../generated-test-sources/assertj-assertions/org/assertj/examples/data/BddAssertions.java</code></pre>
<h3 class="page-header"><span id="configuration" class="adjustAnchor"></span>Plugin configuration</h3>
<p>Let's start with an example, the description of each configuration element is done afterwards :</p>
<pre><code class="xml"><plugin>
<groupId>org.assertj</groupId>
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
<version>2.1.0</version>
<!-- Generate assertions at every build -->
<executions>
<execution>
<goals>
<goal>generate-assertions</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- List the package of classes you want to generate assertions for -->
<packages>
<param>org.assertj.examples.rpg</param>
<param>org.assertj.examples.data</param>
<param>com.google.common.net</param>
</packages>
<!-- List the classes you want to generate assertions for -->
<classes>
<param>java.nio.file.Path</param>
<param>com.fake.UnknownClass</param>
</classes>
<!-- Whether generated assertions classes can be inherited with consistent assertion chaining -->
<hierarchical>true</hierarchical>
<!--
If true, generate assertions for all fields whatever their visibility is (including private).
Default to false which means assertions are only generated for public fields.
-->
<generateAssertionsForAllFields>true</generateAssertionsForAllFields>
<!-- Where to generate assertions entry point classes -->
<entryPointClassPackage>org.assertj</entryPointClassPackage>
<!-- Restrict classes to generate assertions for with regex -->
<includes>
<param>org\.assertj\.examples\.rpg.*</param>
</includes>
<!-- Exclude classes matching the regex from generation -->
<excludes>
<param>.*google.*HostSpecifier</param>
<param>.*google.*Headers</param>
<param>.*google.*MediaType</param>
<param>.*google.*Escaper.*</param>
<param>.*Examples.*</param>
</excludes>
<!-- Sets the base directory where to generate assertions -->
<targetDir>src/test/generated-assertions</targetDir>
<!-- If true, all files in targetDir are removed before generating new ones (default to false) -->
<cleanTargetDir>true</cleanTargetDir>
<!--
Set the package where assertion classes are generated, combine it with targetDir to
get the path to assertions classes.
Ex: com.nba.Player -> src/test/generated-assertions/my/assertions/PlayerAssert
If not set, each assertion class is generated in the package of the class to assert.
Ex: com.nba.Player -> src/test/generated-assertions/com/nba/PlayerAssert
-->
<generateAssertionsInPackage>my.assertions</generateAssertionsInPackage>
<!-- Select which assertions entry point classes to generate -->
<generateAssertions>true</generateAssertions>
<generateBddAssertions>true</generateBddAssertions>
<generateSoftAssertions>true</generateSoftAssertions>
<generateJUnitSoftAssertions>true</generateJUnitSoftAssertions>
<!--
Set the scope of generated sources when added to the maven build.
Value must be 'test' or 'compile' to and defaults to 'test'.
-->
<generatedSourcesScope>compile</generatedSourcesScope>
<!-- If true, the plugin does not produce any logs (default to false) -->
<quiet>true</quiet>
<!--
The generated assertions report is written to the given file.
The base directory containing the report file is where the plugin is executed.
-->
<writeReportInFile>assertions-generation-report.txt</writeReportInFile>
<!-- If true, do not generate assertions, it's a way to disable the plugin -->
<skip>true</skip>
</configuration>
</plugin></code></pre>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Specify packages and classes</h4>
<span class="small-code">packages</span> and <span class="small-code">classes</span> configuration elements indicate where to find the classes you want to generate assertions for.
<p>Instead of declaring packages / classes in the <span class="small-code">pom.xml</span> you can use the properties <span class="small-code">assertj.packages</span> and <span class="small-code">assertj.classes</span>:
<pre><code class="bash">mvn assertj:generate-assertions -Dassertj.packages=your.first.package,your.second.package</code></pre></p>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Including and excluding classes from assertion generation</h4>
<p>Sometimes - not to say often - you don't want to generate assertions for all the classes of the specified packages. To avoid that, exclude classes using regular expressions. In the example below, we generate assertions for all classes in <span class="small-code">com.google.common.net</span> <b>except</b> for classes finishing with <span class="small-code">HostSpecifier</span>, <span class="small-code">Headers</span> or containing <span class="small-code">Escaper</span> :</p>
<pre><code class="xml"><configuration>
<packages>
<param>com.google.common.net</param>
</packages>
<excludes>
<param>.*google.*HostSpecifier</param>
<param>.*google.*Headers</param>
<param>.*google.*Escaper.*</param>
</excludes>
</configuration></code></pre>
<p>From the specified packages, it might be easier to <b>restrict</b> the classes you want to generate assertions for. You can do this by including them using regular expressions. Only classes from the specified packages matching at least one of the given regular expressions will have assertions generated for. In the example below, assertions will only be generated for DTO and Model classes :</p>
<pre><code class="xml"><configuration>
<packages>
<param>com.my.project</param>
</packages>
<includes>
<param>.*DTO</param>
<param>.*Model</param>
</includes>
</configuration></code></pre>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Generated classes destination directory</h4>
<p>You can specify the directory where assertion files are generated using the <span class="small-code">targetDir</span> configuration element, e.g. :</p>
<pre><code class="xml"><configuration>
<packages>
<param>your.first.package</param>
<param>your.second.package</param>
</packages>
<targetDir>src/test/java</targetDir>
</configuration></code></pre>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Selecting which assertion entry point classes to generate</h4>
<p>By default all assertions entry point classes are generated (<span class="small-code">JUnitSoftAssertions</span> are not generated if JUnit can not be found). You can configure which entry point classes to generate as shown below :</p>
<pre><code class="xml"><configuration>
<packages>
<param>your.first.package</param>
<param>your.second.package</param>
</packages>
<!-- select entry point classes to generate -->
<generateAssertions>false</generateAssertions>
<generateBddAssertions>true</generateBddAssertions>
<generateSoftAssertions>true</generateSoftAssertions>
<generateJUnitSoftAssertions>true</generateJUnitSoftAssertions>
</configuration>
</plugin></code></pre>
<p></p>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Assertions entry point classes directory</h4>
<p>Assertions entry point classes are generated in a package determined programatically, you can change it with the <span class="small-code">entryPointClassPackage</span> configuration property :
<pre><code class="xml"><configuration>
<entryPointClassPackage>my.entry.point.package</entryPointClassPackage>
</configuration></code></pre></p>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Generating hierarchical assertion classes</h4>
<p>You can generate assertion classes that don't hide subclasses assertions after using an assertion from a super class. To do that, we need to generate two classes per domain class, e.g. for the <span class="small-code">Book</span> domain class, <span class="small-code">AbstractBookAssert.java</span> and <span class="small-code">BookAssert.java</span> will be generated. Set the <span class="small-code">hierarchical</span> property to true to enable this :
<pre><code class="xml"><configuration>
<hierarchical>true</hierarchical>
</configuration></code></pre></p>
<h4 class="page-header"><span id="custom-templates" class="adjustAnchor"></span><i class="fa fa-caret-right"> </i>Customizing generated assertions</h4>
<p>Assertions are generated using templates that define skeleton code with <a href="assertj-assertions-generator.html#template-variables">variables</a>, as explained in detail <a href="assertj-assertions-generator.html#generated-assertions-templates">here</a>.</p>
<p>Since version 2.0, users can replace the existing <a href="assertj-assertions-generator.html#templates-list">templates</a> by their own to change how assertions are generated. See below an example of such a configuration :</p>
<pre><code class="xml"><configuration>
<templates>
<!-- specify the base directory where to look for templates -->
<templatesDirectory>src/test/resources/templates/</templatesDirectory>
<!-- change Object generated assertions (ex hasName(String expected)) -->
<objectAssertion>my_object_assertion_template.txt</objectAssertion>
<!-- change Iterable generated assertions (ex hasTeamMates(String... teamMates)) -->
<iterableAssertion>my_iterable_assertion_template.txt</iterableAssertion>
</templates>
</configuration></code></pre>
<h5>Configurable template properties :</h5>
<pre><code class="xml"><templates>
<!-- assertion method templates -->
<objectAssertion>my_has_assert_template.txt</objectAssertion>
<arrayAssertion>my_array_assert_template.txt</arrayAssertion>
<iterableAssertion>my_iterable_assert_template.txt</iterableAssertion>
<booleanAssertion>my_boolean_assert_template.txt</booleanAssertion>
<booleanWrapperAssertion>my_Boolean_wrapper_assert_template.txt</booleanWrapperAssertion>
<charAssertion>my_char_assert_template.txt</charAssertion>
<characterAssertion>my_Character_assert_template.txt</characterAssertion>
<realNumberAssertion>my_real_number_assert_template.txt</realNumberAssertion>
<realNumberWrapperAssertion>my_real_number_wrapper_assert_template.txt</realNumberWrapperAssertion>
<wholeNumberAssertion>my_whole_number_assert_template.txt</wholeNumberAssertion>
<wholeNumberWrapperAssertion>my_whole_number_wrapper_assert_template.txt</wholeNumberWrapperAssertion>
<!-- assertion class templates -->
<assertionClass>my_assertion_class_template.txt<assertionClass>
<hierarchicalAssertionConcreteClass>my_hierarch_concrete_class.txt</hierarchicalAssertionConcreteClass>
<hierarchicalAssertionAbstractClass>my_hierarch_base_class.txt</hierarchicalAssertionAbstractClass>
<!-- entry point templates -->
<assertionsEntryPointClass>my_Assertions_class_template.txt</assertionsEntryPointClass>
<assertionEntryPointMethod>my_assertThat_method_template.txt</assertionEntryPointMethod>
<bddEntryPointAssertionClass>my_BddAssertions_class_template.txt</bddEntryPointAssertionClass>
<bddEntryPointAssertionMethod>my_then_method_template.txt</bddEntryPointAssertionMethod>/
<softEntryPointAssertionClass>my_SoftAssertions_class_template.txt</softEntryPointAssertionClass>
<softEntryPointAssertionMethod>my_soft_assertThat_method_template.txt</softEntryPointAssertionMethod>
<junitSoftEntryPointAssertionClass>my_JunitSoftAssertions_class_template.txt</junitSoftEntryPointAssertionClass>
</templates></code></pre>
<h5>Default template properties values (used if not replaced) :</h5>
<table width="100%">
<tr>
<th>Assertion method property</th>
<th>Default template file</th>
</tr>
<tr>
<td>objectAssertion</td>
<td>has_assertion_template.txt</td>
</tr>
<tr>
<td>arrayAssertion</td>
<td>has_elements_assertion_template_for_array.txt</td>
</tr>
<tr>
<td>iterableAssertion</td>
<td>has_elements_assertion_template_for_iterable.txt</td>
</tr>
<tr>
<td>booleanAssertion</td>
<td>is_assertion_template.txt</td>
</tr>
<tr>
<td>booleanWrapperAssertion</td>
<td>is_wrapper_assertion_template.txt</td>
</tr>
<tr>
<td>charAssertion</td>
<td>has_assertion_template_for_char.txt</td>
</tr>
<tr>
<td>characterAssertion</td>
<td>has_assertion_template_for_character.txt</td>
</tr>
<tr>
<td>wholeNumberAssertion</td>
<td>has_assertion_template_for_whole_number.txt</td>
</tr>
<tr>
<td>wholeNumberWrapperAssertion</td>
<td>has_assertion_template_for_whole_number_wrapper.txt</td>
</tr>
<tr>
<td>realNumberAssertion</td>
<td>has_assertion_template_for_real_number.txt</td>
</tr>
<tr>
<td>realNumberWrapperAssertion</td>
<td>has_assertion_template_for_real_number_wrapper.txt</td>
</tr>
</table>
<p> </p>
<table width="100%">
<tr>
<th>Assertion class property</th>
<th>Default template file</th>
</tr>
<tr>
<td>assertionClass</td>
<td>custom_assertion_class_template.txt</td>
</tr>
<tr>
<td>hierarchicalAssertionAbstractClass</td>
<td>custom_abstract_assertion_class_template.txt</td>
</tr>
<tr>
<td>hierarchicalAssertionConcreteClass</td>
<td>custom_hierarchical_assertion_class_template.txt</td>
</tr>
</table>
<p> </p>
<table width="100%">
<tr>
<th>Assertion entry point property</th>
<th>Default template file</th>
</tr>
<tr>
<td>assertionsEntryPointClass</td>
<td>standard_assertions_entry_point_class_template.txt</td>
</tr>
<tr>
<td>assertionEntryPointMethod</td>
<td>standard_assertion_entry_point_method_template.txt</td>
</tr>
<tr>
<td>bddEntryPointAssertionClass</td>
<td>bdd_assertions_entry_point_class_template.txt</td>
</tr>
<tr>
<td>bddEntryPointAssertionMethod</td>
<td>bdd_assertion_entry_point_method_template.txt</td>
</tr>
<tr>
<td>softEntryPointAssertionClass</td>
<td>soft_assertions_entry_point_class_template.txt</td>
</tr>
<tr>
<td>softEntryPointAssertionMethod</td>
<td>soft_assertion_entry_point_method_template.txt</td>
</tr>
<tr>
<td>junitSoftEntryPointAssertionClass</td>
<td>junit_soft_assertions_entry_point_class_template.txt</td>
</tr>
</table>
<h5>Where can default template files be found ?</h5>
<p>The default template files can be found either in the assertj-assertions-generator-2.x.x jar or in <a href="https://github.com/joel-costigliola/assertj-assertions-generator/tree/assertj-assertions-generator-2.0.0/src/main/resources/templates">assertj-assertions-generator github project</a>.</p>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Generating assertion classes with every build</h4>
<p>To generate assertions classes with every build, add an <span class="small-code"><executions></span> section as shown below :</p>
<pre><code class="xml"><plugin>
<groupId>org.assertj</groupId>
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<goals>
<goal>generate-assertions</goal>
</goals>
</execution>
</executions>
<configuration>
<packages>
<param>your.first.package</param>
<param>your.second.package</param>
</packages>
</configuration>
</plugin></code></pre>
<p></p>
<h4 class="page-header"><i class="fa fa-caret-right"> </i>Disabling assertions generation</h4>
<p>To disable assertions generation, set <span class="small-code">assertj.skip</span> to <span class="small-code">true</span>:
<pre><code class="bash">mvn assertj:generate-assertions -Dassertj.skip=true</code></pre></p>
<h3 class="page-header"><span id="news"></span><span id="2.1.0"></span>Assertions generator maven plugin 2.1.0 release</h3>
<p>Release date : 2017-10-01</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#2.1.0">assertj-assertions-generator 2.1.0</a>.</li>
<li><b>Breaking change</b>: Generates hierarchical assertions by default (set <span class="small-code">hierarchical</span> to false to keep the old behaviour).</li>
<li>Add <span class="small-code">cleanTargetDir</span> flag to clean the directory where assertions are generated before generating new ones.</li>
<li>Add <span class="small-code">quiet</span> flag to quiet the plugin (no output logs).</li>
<li>Add <span class="small-code">writeReportInFile</span> option to write plugin output to the given file.</li>
<li>Add <span class="small-code">generatedSourcesScope</span> option to set the scope of generated sources (defaults to <span class="small-code">test</span>).</li>
<li>Add <span class="small-code">generateAssertionsForAllFields</span> flag to generate assertions for all fields whatever their visibility is.</li>
<li>Add <span class="small-code">generateAssertionsInPackage</span> to specify in which package assertions are generated (if not set, assertions are generated in the same package as the class to assert).</li>
</ul>
For all new configuration elements, see the plugin <a href="#configuration">configuration example</a>.
<h3 class="page-header"><span id="news"></span><span id="2.0.0"></span>Assertions generator maven plugin 2.0.0 release</h3>
<p>Release date : 2015-08-16</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#2.0.0">assertj-assertions-generator 2.0.0</a>.</li>
<li>Allow users to <a href="#custom-templates">customize generated assertions</a> using their own templates.</li>
<li>Documentation improvements.</li>
</ul>
<h3 class="page-header"></span><span id="1.6.0"></span>Assertions generator maven plugin 1.6.0 release</h3>
<p>Release date : 2015-04-11</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.6.0">assertj-assertions-generator 1.6.0</a>.</li>
</ul>
<h3 class="page-header"><span id="news"></span><span id="1.5.0"></span>Assertions generator maven plugin 1.5.0 release</h3>
<p>Release date : 2014-11-02</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.5.0">assertj-assertions-generator 1.5.0</a> which adds <span class="small-code">JUnitSoftAssertions</span> generation.</li>
<li>Allow to select which assertions entry point classes are generated among <span class="small-code">Assertions</span>, <span class="small-code">BddAssertions</span>,<span class="small-code">SoftAssertions</span> and <span class="small-code">JUnitSoftAssertions</span>.</li>
<li>Assertions generation report list the input classes that were not found.</li>
</ul>
<h3 class="page-header"><span id="news"></span><span id="1.4.1"></span>Assertions generator maven plugin 1.4.1 release</h3>
<p>Release date : 2014-08-31</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.4.0">assertj-assertions-generator 1.4.0</a> which fixes a bunch of issues.</li>
</ul>
<h3 class="page-header"></span><span id="1.4.0"></span>Assertions generator maven plugin 1.4.0 release</h3>
<p>Release date : 2014-08-17</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.3.1">assertj-assertions-generator 1.3.1</a></li>
<li>Allow to generate assertion for classes located in src/test/java</span></li>
<li>Allow to generate assertion for classes located in project dependencies</span></li>
<li>Allow selecting classes to generate assertions for with regexp (see <a href="assertj-assertions-generator-maven-plugin.html#configuration">Configuration</a>).</li>
<li>Add skip option (see <a href="assertj-assertions-generator-maven-plugin.html#configuration">Configuration</a>).</li>
</ul>
<h3 class="page-header"></span><span id="1.3.0"></span>Assertions generator maven plugin 1.3.0 release</h3>
<p>Release date : 2014-08-04</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.3.0">assertj-assertions-generator 1.3.0</a> with :
<ul><li>Better generated assertions for double and float types using offset.</li></ul>
<ul><li>Generated assertions for public fields.</li></ul>
<ul><li>Avoid potential inner class assertion name clash when several inner classes have the same name.</li></ul>
</li>
<li>Allow to generate assertion classes that don't hide subclasses assertions after using an assertion from a super class. <span class="contributor">(Fr Jeremy Krieg)</span></li>
<li>Allow to specify where to generate Assertions entry point classes.</li>
<li>Generate a BDD style entry point class <a href="assertj-core-news.html#assertj-core-1.6.0-bdd-assertions-style"><span class="small-code">BddAssertions</span></a> replacing <span class="small-code">assertThat</span> methods by <span class="small-code">then</span>.</li>
<li>Generate a <a href="http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html#soft-assertions">SoftAssertions</a> entry point class to collect all assertion errors instead of stopping at the first one.</li>
<li>Better generation report.</li>
</ul>
<h3 class="page-header"><span id="1.2.0"></span>Assertions generator maven plugin 1.2.0 release</h3>
<p>Release date : 2013-12-08</p>
<p>Special thanks to <span class="contributor">Jean Christophe Gay</span> for its contributions to this version.</p>
<div class="release-section-category">Release notes:</div>
<ul>
<li>Uses <a href="assertj-assertions-generator.html#1.2.0">assertj-assertions-generator 1.2.0</a>.</li>
<li>To ease using generated assertions, generate an entry point class <span class="small-code">Assertions</span> providing <span class="small-code">assertThat</span> methods giving access to each generated <span class="small-code">*Assert</span> classes.</li>
<li>Better logs to understand what the plugin is doing.</li>
<li>Define property for each parameter: classes, packages and targetDir. <span class="contributor">(Jean Christophe Gay)</span></li>
<li>Generate Help Mojo accessible via command <span class="small-code">mvn assertj:help</span>. <span class="contributor">(Jean Christophe Gay)</span></li>
<li>Define property for each parameter: classes, packages and targetDir. <span class="contributor">(Jean Christophe Gay)</span></li>
<li>Use up to date @parameter syntax to fix warning logs. <span class="contributor">(Jean Christophe Gay)</span></li>
</ul>
<h3 class="page-header">Assertions generator maven plugin 1.1.0 release</h3>
<p>Release date : 2013-09-15</p>
<p>This version uses assertj-assertions-generator 1.1.0.</p>
<h3 class="page-header">Assertions generator maven plugin 1.0.0 release</h3>
<p>Release date : 2013-03-26</p>
<p>The first release after Fest fork, generated assertions are cleaner.</p>
<h3 class="page-header"><span id="mailing-list"/></span>Mailing list</h3>
<p>If you have any questions, please use
<a href="https://groups.google.com/forum/?fromgroups=#!forum/assertj">AssertJ google group</a>.</p>
<h3 class="page-header"><span id="code"/></span>Code and issue tracker</h3>
<p>AssertJ assertions generator maven plugin is hosted on github : <a href="https://github.com/joel-costigliola/assertj-assertions-generator-maven-plugin">https://github.com/joel-costigliola/assertj-assertions-generator-maven-plugin</a>.</p>
<p>Please report bugs or missing features in <a href="https://github.com/joel-costigliola/assertj-assertions-generator-maven-plugin/issues?labels=&milestone=&page=1&state=open">AssertJ assertions generator maven plugin issue tracker</a>.</p>
<h3 class="page-header"><span id="contributing"/></span>Contributing</h3>
<p>Thanks for your interest ! Please check our <a href="https://github.com/joel-costigliola/assertj-assertions-generator-maven-plugin/blob/master/CONTRIBUTING.md#contributing">contributor's guidelines</a>.</p>
<p>Special thanks to AssertJ assertions generator maven plugin contributors:</p>
<ul>
<li>Jean Christophe Gay</span></li>
<li>Michal Ostruszka</li>
</ul>
</div>
</div>
</div>
</div>
<br>
<!--
<div class="container">
<footer>
<div class="row">
<div class="col-lg-12">
<p>AssertJ - Licensed under the Apache License, Version 2.0.</p>
</div>
</div>
</footer>
</div>
-->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/modern-business.js"></script>
<script src="js/assertj.js"></script>
</body>
</html>