@Test
public void getMetadata() throws Exception {

    DataSetMetadataBuilder builder = metadataBuilder.metadata().id("1234");
    builder
            .row(ColumnMetadata.Builder//
                    .column()//
                    .id(1234)//
                    .name("id")//
                    .empty(0)//
                    .invalid(0)//
                    .valid(0)//
                    .type(Type.STRING))//
            .created(0)//
            .name("name")//
            .author("author")//
            .footerSize(0) //
            .headerSize(1) //
            .qualityAnalyzed(true) //
            .schemaAnalyzed(true) //
            .formatFamilyId(new CSVFormatFamily().getBeanId()) //
            .mediaType("text/csv");
    DataSetMetadata metadata = builder.build();
    metadata.getContent().addParameter(CSVFormatFamily.SEPARATOR_PARAMETER, ";");
    dataSetMetadataRepository.save(metadata);
    String contentAsString = when().get("/datasets/{id}/metadata", "1234").asString();
    InputStream expected = this.getClass().getResourceAsStream("../metadata1.json");
    assertThat(contentAsString, sameJSONAsFile(expected));
    Boolean isFavorites = from(contentAsString).get("metadata.favorite");
    assertFalse(isFavorites);
    // add favorite
    UserData userData = new UserData(security.getUserId(), versionService.version().getVersionId());
    HashSet<String> favorites = new HashSet<>();
    favorites.add("1234");
    userData.setFavoritesDatasets(favorites);
    userDataRepository.save(userData);
    contentAsString = when().get("/datasets/{id}/metadata", "1234").asString();
    isFavorites = from(contentAsString).get("metadata.favorite");
    assertTrue(isFavorites);
}