@Test
public void testResetRecordingState() throws Exception {

  final String mpId = "mpid";
  final String orgId = new DefaultOrganization().getId();
  final String agentId = "agent1";
  final Date start = new Date(1546844400000L); // 2019-01-07T07:00:00Z
  final Date end = new Date(1570953300000L); // 2019-10-13T07:55:00Z
  final String source = "source";
  final String recordingState = "recordingState";
  final Long lastHeard = new Date().getTime();
  final String presenters = "Werner";
  final Date lastModifiedDate = new Date();
  final String checksum = "checksum";
  final Map<String, String> wfProperties = Collections.singletonMap("wffoo", "wfbar");
  final Map<String, String> caProperties = Collections.singletonMap("cafoo", "cabar");
  schedulerDatabase.storeEvent(
      mpId,
      orgId,
      Opt.some(agentId),
      Opt.some(start),
      Opt.some(end),
      Opt.some(source),
      Opt.some(recordingState),
      Opt.some(lastHeard),
      Opt.some(presenters),
      Opt.some(lastModifiedDate),
      Opt.some(checksum),
      Opt.some(wfProperties),
      Opt.some(caProperties)
  );
  schedulerDatabase.resetRecordingState(mpId);
  final Opt<ExtendedEventDto> updatedEvent = schedulerDatabase.getEvent(mpId);
  Assert.assertTrue(updatedEvent.isSome());
  Assert.assertEquals(mpId, updatedEvent.get().getMediaPackageId());
  Assert.assertEquals(orgId, updatedEvent.get().getOrganization());
  Assert.assertEquals(agentId, updatedEvent.get().getCaptureAgentId());
  Assert.assertEquals(start, updatedEvent.get().getStartDate());
  Assert.assertEquals(end, updatedEvent.get().getEndDate());
  Assert.assertEquals(source, updatedEvent.get().getSource());
  Assert.assertNull(updatedEvent.get().getRecordingState());
  Assert.assertNull(updatedEvent.get().getRecordingLastHeard());
  Assert.assertEquals(presenters, updatedEvent.get().getPresenters());
  Assert.assertEquals(lastModifiedDate, updatedEvent.get().getLastModifiedDate());
  Assert.assertEquals(checksum, updatedEvent.get().getChecksum());
  Assert.assertEquals(new Gson().toJson(wfProperties), updatedEvent.get().getWorkflowProperties());
  Assert.assertEquals(new Gson().toJson(caProperties), updatedEvent.get().getCaptureAgentProperties());
}