@GET
    @Path("/journalestimate")
    @NoAuditEvent("No audit event needed")
    @RequiresPermissions(RestPermissions.DATANODE_MIGRATION)
    @ApiOperation(value = "Get journal size estimate (bytes/minute)")
    public JournalEstimate getJournalEstimate() {
        long bytesPerMinute = stateMachine.getContext()
                .getExtendedState(TrafficSnapshot.ESTIMATED_TRAFFIC_PER_MINUTE, Long.class)
                .orElse(0L);
        long journalSize = journalConfiguration.getMessageJournalMaxSize().toBytes();
        long maxDowntimeMinutes = (bytesPerMinute != 0) ? Math.floorDiv(journalSize, bytesPerMinute) : journalSize;
        return new JournalEstimate(bytesPerMinute, journalSize, maxDowntimeMinutes);
    }
@Test
    void testJournalEstimate() {
        MigrationStateMachine stateMachine = createStateMachine();
        final MigrationStateResource resource = new MigrationStateResource(stateMachine, mockHttpHeaders(), journalConfiguration);
        when(journalConfiguration.getMessageJournalMaxSize()).thenReturn(Size.bytes(10000));
        JournalEstimate journalEstimate = resource.getJournalEstimate();
        assertThat(journalEstimate.journalSize()).isEqualTo(10000L);
        assertThat(journalEstimate.maxDowntimeMinutes()).isEqualTo(10000L);
        stateMachine.getContext().addExtendedState(TrafficSnapshot.ESTIMATED_TRAFFIC_PER_MINUTE, 3000L);
        assertThat(resource.getJournalEstimate().maxDowntimeMinutes()).isEqualTo(3L);
    }