@Test
public void testFavorite() {

    // given
    final String datasetId = UUID.randomUUID().toString();
    final DataSetMetadata dataSetMetadata =
            metadataBuilder.metadata().id(datasetId).formatFamilyId(new CSVFormatFamily().getBeanId()).build();
    dataSetMetadata.getContent().addParameter(CSVFormatFamily.SEPARATOR_PARAMETER, ";");
    dataSetMetadataRepository.save(dataSetMetadata);
    contentStore.storeAsRaw(dataSetMetadata, new ByteArrayInputStream(new byte[0]));
    final UserData userData = new UserData(security.getUserId(), versionService.version().getVersionId());
    userDataRepository.save(userData);
    final Set<String> favorites = new HashSet<>();
    favorites.add(datasetId);
    boolean isFavorite = from(when().get("/datasets/{id}/content", datasetId).asString()).get("metadata.favorite");
    assertFalse(isFavorite);
    // when
    userData.setFavoritesDatasets(favorites);
    userDataRepository.save(userData);
    // then
    isFavorite = from(when().get("/datasets/{id}/content", datasetId).asString()).get("metadata.favorite");
    assertTrue(isFavorite);
}