@Test
void get() throws Exception {

    final PowerTenant a = mockTenant(harmlessZonky(), true);
    final ExecutorService e = Executors.newFixedThreadPool(1);
    final Scheduler s = Scheduler.create();
    try (final Daemon d = spy(new Daemon(a, lifecycle, s))) {
        assertThat(d.getSessionInfo()).isSameAs(a.getSessionInfo());
        doNothing().when(d)
            .submitWithTenant(any(), any(), any(), any(), any(), any());
        doNothing().when(d)
            .submitTenantless(any(), any(), any(), any(), any(), any());
        final Future<ReturnCode> f = e.submit(d::get); // will block
        assertThatThrownBy(() -> f.get(1, TimeUnit.SECONDS)).isInstanceOf(TimeoutException.class);
        lifecycle.resumeToShutdown(); // unblock
        assertThat(f.get()).isEqualTo(ReturnCode.OK); // should now finish
        // call all the jobs and daemons we know about
        verify(d, times(1)).submitTenantless(any(), any(SimplePayload.class), any(), any(), any(), any());
        verify(d, times(8)).submitWithTenant(any(), any(), any(), any(), any(), any());
    } finally {
        e.shutdownNow();
    }
    verify(a).close();
    assertThat(s.isClosed()).isTrue();
}