@Test
  public void testFinalizeAfterMarkFinalized() {
    Runnable task = mock(Runnable.class);

    ObjectFinalizer finalizer = new ObjectFinalizer(task, "DESCRIPTION");
    finalizer.markFinalized();
    try (LogCollector logs = LogCollectorTest.startCollecting()) {
      finalizeObject(finalizer);
      assertEquals(0, logs.getNumberOfLogs());
    }

    verifyZeroInteractions(task);
  }
  @Test
  public void testFinalizeBeforeDoFinalizeInheritMessage() {
    Runnable task = mock(Runnable.class);
    stub(task.toString()).toReturn("DESCRIPTION");

    ObjectFinalizer finalizer = new ObjectFinalizer(task);
    try (LogCollector logs = LogCollectorTest.startCollecting()) {
      finalizeObject(finalizer);
      assertEquals(1, logs.getNumberOfLogs());
    }

    verify(task).run();
    verifyNoMoreInteractions(task);
  }
  @Test
  public void testFinalizeBeforeDoFinalize() {
    Runnable task = mock(Runnable.class);

    ObjectFinalizer finalizer = new ObjectFinalizer(task, "DESCRIPTION");

    try (LogCollector logs = LogCollectorTest.startCollecting()) {
      finalizeObject(finalizer);
      assertEquals(1, logs.getNumberOfLogs(Level.SEVERE));
    }

    verify(task).run();
    verifyNoMoreInteractions(task);
  }