-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathassertj-db-concepts.html
2051 lines (1933 loc) · 144 KB
/
assertj-db-concepts.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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!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"></li>
<li><a href="assertj-db.html">Overview</a></li>
<li><a href="assertj-db.html#quickstart">Quick start</a></li>
<li><a href="assertj-db-news.html">News & releases</a></li>
<li><a href="assertj-db-concepts.html">Concepts</a></li>
<li><a href="assertj-db-features-highlight.html">Features highlight</a></li>
<li><a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/index.html" target="_blank">Javadoc</a></li>
<li><a href="assertj-db.html#mailing-list">Mailing list</a></li>
<li><a href="assertj-db.html#code">Code & issues <i class="fa fa-github"></i></a></li>
<li><a href="assertj-db.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-DB concepts</h1>
<h2 style="color:darkblue;font-style: italic;"><u>AssertJ-DB site has moved to <a href="https://assertj.github.io/doc/#assertj-db">https://assertj.github.io/doc/</a></u></h2>
<p>The purpose of this page is to show the different concepts specific to AssertJ-DB.</p>
<ul>
<li><a href="#connection">Connection to the database</a>
<ul>
<li><a href="#datasource">DataSource</a></li>
<li><a href="#source">Source</a></li>
<li><a href="#datasourcewithlettercase">DataSource with LetterCase</a> <small><i>(since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a>)</i></small></li>
<li><a href="#sourcewithlettercase">Source with LetterCase</a> <small><i>(since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a>)</i></small></li>
</ul>
</li>
<li><a href="#elements">Elements of the database</a>
<ul>
<li><a href="#table">Table</a> <small><i>(modified in <a href="assertj-db-news.html#assertj-db-1.2.0">1.2.0</a>)</i></small></li>
<li><a href="#request">Request</a></li>
<li><a href="#changes">Changes</a></li>
<li><a href="#change">Change</a></li>
<li><a href="#row">Row</a></li>
<li><a href="#column">Column</a></li>
<li><a href="#value">Value</a></li>
</ul>
</li>
<li><a href="#type">Type</a>
<ul>
<li><a href="#datatype">DataType</a></li>
<li><a href="#changetype">ChangeType</a></li>
<li><a href="#valuetype">ValueType</a></li>
<li><a href="#ordertype">OrderType</a> <small><i>(since <a href="assertj-db-news.html#assertj-db-1.2.0">1.2.0</a>)</i></small></li>
</ul>
</li>
<li><a href="#navigation">Navigation</a>
<ul>
<li><a href="#tableorrequestasroot">With a Table or a Request as root</a></li>
<li><a href="#changesasroot">With Changes as root</a></li>
</ul>
</li>
<li><a href="#datevalue-timevalue-datetimevalue">DateValue, TimeValue and DateTimeValue</a></li>
<li><a href="#default-description">Default description</a></li>
<li><a href="#dblettercase">Letter Case of the database</a> <small><i>(since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a>)</i></small>
<ul>
<li><a href="#caseconversion">CaseConversion</a></li>
<li><a href="#casecomparison">CaseComparison</a></li>
<li><a href="#lettercase">LetterCase</a></li>
</ul>
</li>
<li><a href="#output">Output</a> <small><i>(since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a>)</i></small>
<ul>
<li><a href="#typeoutput">Type of output</a></li>
<li><a href="#destination">Destination</a></li>
</ul>
</li>
</ul>
<p>For the examples below, suppose that the database contains these three tables :</p>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">MEMBERS</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">BIRTHDATE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">05-10-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">08-08-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.77</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Adam'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-13-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.78</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Larry'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-31-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.70</td>
</tr>
</table>
<br/>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">ALBUMS</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">RELEASE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">TITLE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NUMBEROFSONGS</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">DURATION</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">LIVE</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-20-80</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Boy'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">12</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">42:17</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-12-81</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'October'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">41:08</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">02-28-83</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'War'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">42:07</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11-07-83</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Under a Blood Red Sky'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">8</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">33:25</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">true</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">5</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-01-84</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Unforgettable Fire'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">42:42</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">6</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">06-10-85</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Wide Awake in America'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">20:30</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">true</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">7</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-09-87</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Joshua Tree'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">50:11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">8</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-10-88</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Rattle and Hum'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">17</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">72:27</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">9</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11-18-91</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Achtung Baby'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">12</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">55:23</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">07-06-93</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Zooropa'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">51:15</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-03-97</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Pop'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">12</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">60:08</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">12</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-30-00</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'All That You Can't Leave Behind'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">49:23</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">13</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11-22-04</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'How to Dismantle an Atomic Bomb'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">49:08</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">14</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-02-09</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'No Line on the Horizon'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">53:44</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">15</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">09-09-14</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Songs of Innocence'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">48:11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
</table>
<br/>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">GROUP</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'U2'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Coldplay'</td>
</tr>
</table>
<h3 class="page-header" ><span id="connection"></span>Connection to the database</h3>
<p>To make assertions on a database, it is necessary to connect. For that, either to use a <code class="java">DataSource</code>
or a <code class="java">Source</code>.</p>
<h4 class="page-header" ><span id="datasource"></span>DataSource</h4>
<p>A <a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">DataSource</a> is the classic Java way
to get a <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html">Connection</a> to a database.</p>
<h4 class="page-header" ><span id="source"></span>Source</h4>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Source.html">Source</a> is a way
to connect if you have not access to a DataSource or if you do not want to use one. It allows you
to pass the necessary connection information as constructor parameters. Below is an example of using a Source
to connect to H2 in memory database :
</p>
<pre><code class="java">Source source = new Source("jdbc:h2:mem:test", "sa", "");</code></pre>
<h4 class="page-header" ><span id="datasourcewithlettercase"></span>DataSource with LetterCase</h4>
<p><i>Since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a></i></p>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/DataSourceWithLetterCase.html">DataSourceWithLetterCase</a> is a
<a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">DataSource</a> which allows to indicate the
<a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/lettercase/LetterCase.html">LetterCase</a>
for the tables, columns and primary keys.</p>
<pre><code class="java">DataSource ds = new DataSourceWithLetterCase(dataSource,
tableLetterCase,
columnLetterCase,
pkLetterCase);</code></pre>
<p>For more information, see the <a href="#dblettercase">paragraph on LetterCase</a>.</p>
<h4 class="page-header" ><span id="sourcewithlettercase"></span>Source with LetterCase</h4>
<p><i>Since <a href="assertj-db-news.html#assertj-db-1.1.0">1.1.0</a></i></p>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/SourceWithLetterCase.html">SourceWithLetterCase</a> is a
<a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Source.html">Source</a> which allows to indicate the
<a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/lettercase/LetterCase.html">LetterCase</a>
for the tables, columns and primary keys.</p>
<pre><code class="java">Source s = new SourceWithLetterCase("jdbc:h2:mem:test", "sa", "",
tableLetterCase,
columnLetterCase,
pkLetterCase);</code></pre>
<p>For more information, see the <a href="#dblettercase">paragraph on LetterCase</a>.</p>
<h3 class="page-header" ><span id="elements"></span>Elements of the database</h3>
<p>Here the elements on which it is possible to make assertions.</p>
<p>Note that, there are only 3 root elements : <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a>,
<a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Request.html">Request</a>
and <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Changes.html">Changes</a>.</p>
<p>That means that the other elements are components or sub components of a root element.</p>
<p>A root element is an element on which the assertion start (in practice, the parameter of a <code class="java">assertThat(...)</code> method).</p>
</p>
<h4 class="page-header" ><span id="table"></span>Table</h4>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a> represents
a table in the database.<br/>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a>
needs a way to connect to the database (either a <a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">DataSource</a>
or a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Source.html">Source</a>) and a name (the two mandatory constructor parameters).</p>
<pre><code class="java">// Get a DataSource
DataSource dataSource = ...
// Declare the "members" table by using a DataSource
Table table1 = new Table(dateSource, "members");
// Declare the "members" table by using a Source
Table table2 = new Table(source, "members");</code></pre>
<p>The two <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a>s above
(<code class="java">table1</code> and <code class="java">table2</code>) are equivalent.</p>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">Representation of "table1" or "table2"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">BIRTHDATE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">05-10-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">08-08-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.77</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Adam'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-13-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.78</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Larry'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-31-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.70</td>
</tr>
</table>
<br/>
<p>For a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a>,
it is possible to choose the columns to include and to exclude in the assertions.</p>
<pre><code class="java">// Get the data of the "id" and "name" columns of the "members" table
Table table3 = new Table(source, "members", new String[] { "id", "name" }, null);
// Get the data of the "members" table but not of the "birthdate" column
Table table4 = new Table(source, "members", null, new String[] { "birthdate" });
// Get the data of the "name" column of the "members" table (because "id" is included and excluded)
Table table5 = new Table(source, "members", new String[] { "id", "name" }, new String[] { "id" });</code></pre>
<div>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "table3"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
</tr>
</table>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "table4"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.77</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Adam'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.78</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Larry'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.70</td>
</tr>
</table>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "table5"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
</tr>
</table>
</div>
<br/>
<p><i>Since version <a href="assertj-db-news.html#assertj-db-1.2.0">1.2.0</a></i>, there are the possibility to indicate delimiters (start delimiter and end delimiter) and <code class="java"><a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.Order.html">Order</a></code>.</p>
<p>The delimiters are usefull when the table name or column name is a reserved word or contains special characters (like space or '%').
<code class="java"><a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.Order.html">Order</a></code> allows to choose the order of the <code class="java">Row</code>.
</p>
<pre><code class="java">// The line code below throws SQLException because "group" is SQL reserved word
Table table6 = new Table(source, "group");
// Get the data of the "group" table by using "`" delimiter
// That generates a request
Table table7 = new Table(source, "group", '`', '`');
// Get the data from "members" table and order on "name" column in ascending order
Table table8 = new Table(source, "members", new Order[] {
Order.asc("name")
});</code></pre>
<div>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "table7"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'U2'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Colplay'</td>
</tr>
</table>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "table8"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">BIRTHDATE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">3</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Adam'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">03-13-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.78</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">2</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">08-08-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.77</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">05-10-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">4</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Larry'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-31-61</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.70</td>
</tr>
</table>
</div>
<h4 class="page-header" ><span id="request"></span>Request</h4>
<p>A <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Request.html">Request</a> represents
a SQL request on the database.</p>
<p>Like a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Table.html">Table</a>,
a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Request.html">Request</a>
needs a way to connect to the database (either a <a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html">DataSource</a>
or a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Source.html">Source</a>).<br/>
</p>
<pre><code class="java">// Get a DataSource
DataSource dataSource = ...
// Declare a request which gets the name and the firstname of the corresponding members
// by using a Source
Request request1 = new Request(source,
"select name, firstname from members where id = 2 or id = 3");
// Declare a request which gets the name and the firstname of the corresponding members
// by using the DataSource
Request request2 = new Request(dataSource,
"select name, firstname from members where id = 2 or id = 3");</code></pre>
<p>The two <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Request.html">Request</a>s above
(<code class="java">request1</code> and <code class="java">request2</code>) are equivalent.</p>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">Representation of "request1" or "request2"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Clayton'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Adam'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
</table>
<p>For a <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Request.html">Request</a>,
it is possible to use a simple SQL request or a SQL request with one or many parameters.
</p>
<pre><code class="java">// Declare a request which gets the name and the firstname of the members
// and use "%e%" as a parameter
Request request3 = new Request(dataSource,
"select name, firstname from members " +
"where name like ?;",
"%e%");
// Declare a request which gets the name and the firstname of the members
// and use "%e%" and "%Paul%" as parameters
Request request4 = new Request(dataSource,
"select name, firstname from members " +
"where name like ? and firstname like ?;",
"%e%",
"%Paul%");</code></pre>
<div>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "request3"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Evans'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'David Howell'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'The Edge'</td>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Mullen'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Larry'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
</table>
<table border="1" cellspacing="0" cellpadding="2" style="border: 0px solid black;display: inline;">
<caption style="font-size:70%">Representation of "request4"</caption>
<tr>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SURNAME</th>
</tr>
<tr>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
</tr>
</table>
</div>
<h4 class="page-header" ><span id="changes"></span>Changes</h4>
<p>The <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Changes.html">Changes</a>
are the differences of states in database between a <code class="java">start point</code> and a <code class="java">end point</code>.
</p>
<p align="center">
<img src="images/db-changes-1.png" />
</p>
<p>Assume that there are these SQL statements between the start point and the end point.</p>
<pre><code class="sql">DELETE FROM ALBUMS WHERE ID = 15;
INSERT INTO MEMBERS(ID, NAME, FIRSTNAME) VALUES(5, 'McGuiness', 'Paul');
UPDATE MEMBERS SET SURNAME = 'Bono Vox' WHERE ID = 1;
UPDATE ALBUMS SET NAME = 'Rattle & Hum', LIVE = true WHERE ID = 8;
</code></pre>
<pre><code class="java">// Get a DataSource
DataSource dataSource = ...
// The changes can be on a DataSource or on a Source
Changes changes1 = new Changes(dataSource);
Changes changes2 = new Changes(source);
// The changes can also be on a Table or on a Request
Changes changes3 = new Changes(table4);
Changes changes4 = new Changes(request3);
Changes changes5 = new Changes(request4);
// The names of the columns used for the primary key are found in the metadata for a table
// but for a request it can be important to set the primary key
Changes changes6 = new Changes(request4).setPksName("name");</code></pre>
<p>The two <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Changes.html">Changes</a> above
(<code class="java">changes1</code> and <code class="java">changes2</code>) are equivalent.</p>
<p>The two <a href="https://www.javadoc.io/doc/org.assertj/assertj-db/latest/org/assertj/db/type/Changes.html">Changes</a> above
(<code class="java">changes4</code> and <code class="java">changes5</code>) are also equivalent.</p>
<p>The changes are ordered :</p>
<ul>
<li>First by the type of the change : creation, modification and after deletion</li>
<li>After if it a change on a table by the name of the table</li>
<li>To finish by the values of the primary key and if there are no primary key by the values of the row (for a modification)</li>
</ul>
<p>As indicated above, the primary key is used to order the changes.
But more important, the primary key is used to determinate which rows at the same with modifications.<br/>
In <i>Representation of "changes4" or "changes5"</i> the modification of first row of the table become a creation and deletion.
</p>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">Representation of "changes1" or "changes2"</caption>
<tr>
<td style="text-align:center;font-size:70%;width: 80px;background-color:white;">Creation</td>
<td style="text-align:center;font-size:70%;width: 90px;background-color:white;">"MEMBERS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white;"><code class="java" style="font-family:courier;font-size:120%;">5</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white;"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">BIRTHDATE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;" colspan="6"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">5</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'McGuiness'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">Modification</td>
<td style="text-align:center;font-size:70%;background-color:white;">"ALBUMS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white;"><code class="java" style="font-family:courier;font-size:120%;">8</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white;"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">RELEASE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">TITLE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">NUMBEROFSONGS</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">DURATION</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;">LIVE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">8</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-10-88</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Rattle and Hum'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">17</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">72:27</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">8</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">10-10-88</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Rattle & Hum'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">17</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">72:27</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">true</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">Modification</td>
<td style="text-align:center;font-size:70%;background-color:white;">"MEMBERS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white;"><code class="java" style="font-family:courier;font-size:120%;">1</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white;"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;%">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">BIRTHDATE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 50px;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">05-10-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white;">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono Vox'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">05-10-60</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">Deletion</td>
<td style="text-align:center;font-size:70%;background-color:white">"ALBUMS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white"><code class="java" style="font-family:courier;font-size:120%;">15</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 100px;">RELEASE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 180px;">TITLE</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 140px;">NUMBEROFSONGS</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 100px;">DURATION</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;;width: 50px;">LIVE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">15</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">09-09-14 </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Songs of Innocence'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">48:11</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;" colspan="6"> </td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">Representation of "changes3"</caption>
<tr>
<td style="text-align:center;font-size:70%;width: 80px;background-color:white">Creation</td>
<td style="text-align:center;font-size:70%;width: 90px;background-color:white">"MEMBERS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white"><code class="java" style="font-family:courier;font-size:120%;">5</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 50px;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;" colspan="5"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">5</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'McGuiness'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">Modification</td>
<td style="text-align:center;font-size:70%;background-color:white">"MEMBERS" table</td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white"><code class="java" style="font-family:courier;font-size:120%;">1</code> as PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 30px;">ID</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 50px;">SIZE</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono Vox'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">1.75</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table border="1" cellspacing="0" cellpadding="2">
<caption style="font-size:70%">Representation of "changes4" or "changes5"</caption>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">Creation</td>
<td style="text-align:center;font-size:70%;background-color:white"> </td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white">No PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;" colspan="3"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At end point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Hewson'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Paul David'</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;">'Bono Vox'</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;width: 80px;background-color:white">Creation</td>
<td style="text-align:center;font-size:70%;width: 90px;background-color:white"> </td>
<td style="text-align:center;font-size:70%;width: 120px;background-color:white">No PK</td>
<td>
<table border="1" cellspacing="0" cellpadding="2" width="100%">
<tr>
<th style="width: 90px;background-color:white"></th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 100px;">NAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 180px;">FIRSTNAME</th>
<th style="text-align:center;font-family:courier;font-size:90%;background-color:white;width: 140px;">SURNAME</th>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At start point</td>
<td style="text-align:center;font-family:courier;font-size:80%;background-color:white;" colspan="3"> </td>
</tr>
<tr>
<td style="text-align:center;font-size:70%;background-color:white">At end point</td>