@TestFactory
    @Execution(ExecutionMode.SAME_THREAD)
    Stream<DynamicTest> testNoComplexMaps() {
        return buildRelatedResourceTests(clazz -> {
            // Try and find the no args constructor if there is any.
            if (!Modifier.isInterface(clazz.getModifiers())) {
                final Field[] fields = clazz.getDeclaredFields();
                for (final Field field : fields) {
                    // Don't care about static as they are not serialised.
                    if (Map.class.isAssignableFrom(field.getType())
                            && !Modifier.isStatic(field.getModifiers())) {
                        final ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
                        final Type keyType = parameterizedType.getActualTypeArguments()[0];
                        if (!(keyType instanceof Class && ((Class<?>) keyType).isEnum())) {
                            Assertions.assertThat(keyType.getTypeName())
                                    .describedAs(
                                            "%s - Bad key type, maps must have string keys", clazz.getName())
                                    .isEqualTo(String.class.getName());
                        }
                    }
                }
            }
        });
    }
Test that all objects that will be serialised as JSON and contain maps do not use anything other than String as
map keys as this isn't serialisable.
stroom-app/src/test/java/stroom/importexport/TestJsonSerialisation.java