@@ -57,13 +57,31 @@ public void test_has_values() {
57
57
"1950-09-21" ,
58
58
"30B443AE-C0C9-4790-9BEC-CE1380808435"
59
59
)
60
- .hasValues (4 , "Murray" , "Bill" , "1950-09-21" , UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" ));
60
+ .hasValuesSatisfying (
61
+ 4 ,
62
+ new Condition <String >(v -> v .equals ("Murray" ), "isMurray" ),
63
+ new HamcrestCondition <>(CoreMatchers .is ("Bill" )),
64
+ "1950-09-21" ,
65
+ UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" )
66
+ );
61
67
Assertions .assertThat (changeRowAssert ).isSameAs (changeRowAssert2 );
62
68
63
69
TableRowAssert tableRowAssert = assertThat (table ).row ();
64
70
TableRowAssert tableRowAssert2 = tableRowAssert
65
- .hasValues (1 , "Weaver" , "Susan Alexandra" , "1949-10-08" , "30B443AE-C0C9-4790-9BEC-CE1380808435" )
66
- .hasValues (1 , "Weaver" , "Susan Alexandra" , "1949-10-08" , UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" ));
71
+ .hasValuesSatisfying (
72
+ 1 ,
73
+ new Condition <String >(v -> v .equals ("Weaver" ), "isWeaver" ),
74
+ new HamcrestCondition <>(CoreMatchers .is ("Susan Alexandra" )),
75
+ "1949-10-08" ,
76
+ "30B443AE-C0C9-4790-9BEC-CE1380808435"
77
+ )
78
+ .hasValuesSatisfying (
79
+ 1 ,
80
+ new Condition <String >(v -> v .equals ("Weaver" ), "isWeaver" ),
81
+ new HamcrestCondition <>(CoreMatchers .is ("Susan Alexandra" )),
82
+ "1949-10-08" ,
83
+ UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" )
84
+ );
67
85
Assertions .assertThat (tableRowAssert ).isSameAs (tableRowAssert2 );
68
86
}
69
87
@@ -80,24 +98,35 @@ public void should_fail_because_values_are_different() {
80
98
81
99
try {
82
100
assertThat (changes ).change ().rowAtEndPoint ()
83
- .hasValues (4 , "Murray" , "Billy" , "1950-09-21" , UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" ));
101
+ .hasValuesSatisfying (
102
+ 4 ,
103
+ "Murray" ,
104
+ new Condition <String >(v -> v .equals ("Billy" ), "isBilly" ),
105
+ "1950-09-21" ,
106
+ UUID .fromString ("30B443AE-C0C9-4790-9BEC-CE1380808435" )
107
+ );
84
108
} catch (AssertionError e ) {
85
109
Assertions .assertThat (e .getMessage ()).isEqualTo (String .format (
86
110
"[Row at end point of Change at index 0 (with primary key : [4]) of Changes on ACTOR table of 'sa/jdbc:h2:mem:test' source] %n"
87
111
+ "Expecting that the value at index 2:%n"
88
- + " < \" Bill\" > %n"
89
- + "to be equal to : %n"
90
- + " < \" Billy \" > " ));
112
+ + " \" Bill\" %n"
113
+ + "to satisfy : %n"
114
+ + " isBilly " ));
91
115
}
92
116
try {
93
- assertThat (table ).row ().hasValues (1 , "Weaver" , "Sigourney" , "1949-10-08" ,
94
- UUID .fromString ("648DFAC8-14AC-47F7-95CF-3475525A3BE3" ));
117
+ assertThat (table ).row ().hasValuesSatisfying (
118
+ 1 ,
119
+ "Weaver" ,
120
+ new Condition <String >(v -> v .equals ("Sigourney" ), "isSigourney" ),
121
+ "1949-10-08" ,
122
+ UUID .fromString ("648DFAC8-14AC-47F7-95CF-3475525A3BE3" )
123
+ );
95
124
} catch (AssertionError e ) {
96
125
Assertions .assertThat (e .getMessage ()).isEqualTo (String .format ("[Row at index 0 of ACTOR table] %n"
97
126
+ "Expecting that the value at index 2:%n"
98
- + " < \" Susan Alexandra\" > %n"
99
- + "to be equal to : %n"
100
- + " < \" Sigourney \" > " ));
127
+ + " \" Susan Alexandra\" %n"
128
+ + "to satisfy : %n"
129
+ + " isSigourney " ));
101
130
}
102
131
}
103
132
}
0 commit comments