@GET
    @ApiOperation(value = "Retrieve the list of all fields present in the system")
    public Set<MappedFieldTypeDTO> allFieldTypes(@Context SearchUser searchUser) {
        final ImmutableSet<String> streams = searchUser.streams().loadAllMessageStreams();
        return mappedFieldTypesService.fieldTypesByStreamIds(streams, RelativeRange.allTime());
    }
@Test
    public void allFieldTypesReturnsResultFromMappedFieldTypesService() {
        final SearchUser searchUser = TestSearchUser.builder()
                .allowStream("2323")
                .allowStream("4242")
                .build();

        final MappedFieldTypesService fieldTypesService = (streamIds, timeRange) -> {
            if (ImmutableSet.of("2323", "4242").equals(streamIds) && timeRange.equals(RelativeRange.allTime())) {
                return Collections.singleton(MappedFieldTypeDTO.create("foobar",
                        FieldTypes.Type.createType("long", ImmutableSet.of("numeric", "enumerable"))));
            } else {
                return Collections.emptySet();
            }
        };

        final FieldTypesResource resource = new FieldTypesResource(fieldTypesService, mock(IndexFieldTypePollerPeriodical.class));
        final Set<MappedFieldTypeDTO> result = resource.allFieldTypes(searchUser);

        assertThat(result)
                .hasSize(1)
                .hasOnlyOneElementSatisfying(type -> {
                    assertThat(type.name()).isEqualTo("foobar");
                    assertThat(type.type().type()).isEqualTo("long");
                });
    }