1010
1111import org .junit .jupiter .api .Test ;
1212
13- import static org .junit .jupiter .api .Assertions .fail ;
13+ import static org .junit .jupiter .api .Assertions .assertTrue ;
1414
1515public class SupportedParameterTest {
1616
@@ -36,16 +36,15 @@ public class SupportedParameterTest {
3636 @ Test
3737 public void allFieldsShouldBeWhitelisted () throws IllegalAccessException {
3838 Set <String > supportedParameters = getSupportedParameters ();
39- Collection <String > strings = getClassStringFieldsFromClass ();
39+ Collection <String > strings = discoverAllParameterConstants ();
4040
4141 Set <String > missing = strings .stream ()
4242 .filter (f -> !supportedParameters .contains (f ))
4343 .collect (Collectors .toSet ());
4444
45- if (!missing .isEmpty ()) {
46- fail ("The following parameters are defined, but are not added to any structure: " + missing +
47- ".\n To resolve this, add the missing parameters to the appropriate collection in the SupportedParameters class." );
48- }
45+ assertTrue (missing .isEmpty (),
46+ () -> "The following parameters are defined, but are not added to any structure: " + missing +
47+ ".\n To resolve this, add the missing parameters to the appropriate collection in the SupportedParameters class." );
4948 }
5049
5150 private Set <String > getSupportedParameters () {
@@ -73,7 +72,7 @@ private void fillWithNonEntitySpecificSupportedParameters(Set<String> supportedP
7372 supportedParameters .addAll (NESTED_PARAMETERS );
7473 }
7574
76- private Collection <String > getClassStringFieldsFromClass () throws IllegalAccessException {
75+ private Collection <String > discoverAllParameterConstants () throws IllegalAccessException {
7776 Collection <String > strings = new ArrayList <>();
7877 Class <?> clazz = SupportedParameters .class ;
7978 for (Field field : clazz .getDeclaredFields ()) {
0 commit comments