final ServiceContext serviceContext = createServiceContext();
loginAsAdmin(serviceContext);
final int metadataId = importMetadata(this, serviceContext);
final MetadataStatus status = _dataManager.getStatus(metadataId);
assertEquals(null, status);
final ISODate changeDate = new ISODate();
final String changeMessage = "Set to draft";
_dataManager.setStatus(serviceContext, metadataId, 0, changeDate, changeMessage);
final MetadataStatus loadedStatus = _dataManager.getStatus(metadataId);
assertEquals(changeDate, loadedStatus.getId().getChangeDate());
assertEquals(changeMessage, loadedStatus.getChangeMessage());
assertEquals(0, loadedStatus.getStatusValue().getId());
assertEquals(metadataId, loadedStatus.getId().getMetadataId());
assertEquals(0, loadedStatus.getId().getStatusId());
assertEquals(serviceContext.getUserSession().getUserIdAsInt(), loadedStatus.getId().getUserId());
}