@@ -47,24 +47,18 @@ void assertNoMissingFields(M message, Class<E> fields) {
47
47
}
48
48
49
49
public static void assertNoMissingFields (Object message ) {
50
- List <String > nullFields = getMissingFields (message .toString ());
50
+ Set <String > nullFields = getMissingFields (message .toString ());
51
51
52
- Assert .assertArrayEquals (
53
- "All fields expected to be set in the text" ,
54
- new String [0 ],
55
- nullFields .toArray (new String [0 ]));
52
+ Assert .assertEquals ("All fields expected to be set in the text" , new HashSet <>(), nullFields );
56
53
}
57
54
58
55
public static void assertMissingFields (Object message , Set <String > values ) {
59
- List <String > nullFields = getMissingFields (message .toString ());
60
- Assert .assertArrayEquals (
61
- "Expected missing fields but get different" ,
62
- values .toArray (new String [0 ]),
63
- nullFields .toArray (new String [0 ]));
56
+ Set <String > nullFields = getMissingFields (message .toString ());
57
+ Assert .assertEquals ("Expected missing fields but get different" , values , nullFields );
64
58
}
65
59
66
- private static List <String > getMissingFields (String text ) {
67
- List <String > nullFields = new ArrayList <>();
60
+ private static Set <String > getMissingFields (String text ) {
61
+ Set <String > nullFields = new HashSet <>();
68
62
// Regex to find fieldName=null
69
63
Pattern pattern = Pattern .compile ("(\\ w+)=null" );
70
64
Matcher matcher = pattern .matcher (text );
0 commit comments