@Test
public void createDatasetRecordTest() {

    // Setup:
    FormDataMultiPart fd = new FormDataMultiPart().field("title", "title")
            .field("datasetIRI", "http://example.com/dataset")
            .field("repositoryId", "system")
            .field("description", "description")
            .field("markdown", "#markdown")
            .field("keywords", "test")
            .field("keywords", "demo")
            .field("ontologies", ontologyRecordIRI.stringValue());
    Response response = target().path("datasets").request().post(Entity.entity(fd, MediaType.MULTIPART_FORM_DATA));
    assertEquals(response.getStatus(), 201);
    ArgumentCaptor<DatasetRecordConfig> config = ArgumentCaptor.forClass(DatasetRecordConfig.class);
    verify(datasetManager).createDataset(config.capture());
    assertEquals("http://example.com/dataset", config.getValue().getDataset());
    assertEquals("system", config.getValue().getRepositoryId());
    assertEquals(1, config.getValue().getOntologies().size());
    assertEquals("title", config.getValue().getTitle());
    assertEquals("description", config.getValue().getDescription());
    assertEquals("#markdown", config.getValue().getMarkdown());
    assertNull(config.getValue().getIdentifier());
    assertEquals(Stream.of("test", "demo").collect(Collectors.toSet()), config.getValue().getKeywords());
    assertEquals(Collections.singleton(user), config.getValue().getPublishers());
    verify(catalogManager).getMasterBranch(localIRI, ontologyRecordIRI);
    assertEquals(response.readEntity(String.class), record1.getResource().stringValue());
    verify(provUtils).startCreateActivity(user);
    verify(provUtils).endCreateActivity(createActivity, record1.getResource());
}