public void setProfile(final Set<String> indexSetsIds,
                           final String profileId,
                           final boolean rotateImmediately) {
        checkProfile(profileId);
        checkAllIndicesSupportProfileChange(indexSetsIds);

        for (String indexSetId : indexSetsIds) {
            try {
                indexSetService.get(indexSetId).ifPresent(indexSetConfig -> {
                    var updatedIndexSetConfig = setProfileForIndexSet(profileId, indexSetConfig);
                    if (rotateImmediately) {
                        updatedIndexSetConfig.ifPresent(this::cycleIndexSet);
                    }
                });
            } catch (Exception ex) {
                LOG.error("Failed to update field type in index set : " + indexSetId, ex);
                throw ex;
            }
        }
    }
@Test
    void testThrowsExceptionWhenTryingToSetUnExistingProfile() {
        assertThrows(NotFoundException.class, () -> toTest.setProfile(Set.of(), "000000000000000000000042", false));
    }