### Question:
SmartLog { public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCallback) loggableObject; try { callback.afterLoggable(); } catch (Exception e) { ctx.throwable(e); } } ctx.endTime(System.currentTimeMillis()); ctx.output() .write(ctx); ctx.clearMDC() .recoverThreadName(); } else { throw new RuntimeException("Loggable context is absent"); } }  @Nonnull static LogContext start(@Nonnull final Output output); @Nonnull static LogContext start(@Nonnull final Object loggableObject); @Nonnull static LogContext start(@Nonnull final Output output, @Nullable final Object loggableObject); static void finish(); @Nonnull static LogContext current(); @Nonnull static LogContext output(@Nonnull final Output output); @Nonnull static LogContext level(@Nonnull final LogLevel level); @Nonnull static LogContext format(@Nonnull final Format format); @Nonnull static LogContext title(@Nonnull final String title); @Nonnull static LogContext title(@Nonnull final String format, final Object... args); @Nonnull static LogContext attach(@Nonnull final String name, @Nullable final Object value); @Nonnull static LogContext throwable(@Nonnull final Throwable newThrowable); @Nonnull static LogContext trace(final String msg); @Nonnull static LogContext trace(final String format, final Object... args); @Nonnull static LogContext trace(@Nonnull final TraceFlag flag, @Nonnull final String msg); @Nonnull static LogContext trace(@Nonnull final TraceFlag flag, @Nonnull final String msg, @Nonnull final Object... args); @Nonnull static LogContext result(final Object result); @Nonnull static LogContext result(final String description, final Object... args); @Nonnull static LogContext result(final LogLevel level, final Object result); @Nonnull static LogContext result(final LogLevel level, final String description, final Object... args); @Nonnull static LogContext result(final LogLevel level, final Throwable throwable, final String description); @Nonnull static LogContext result(final LogLevel level, final Throwable throwable, final String description, final Object... args);  }### Answer:
@Test public void finishThrowExceptionIfNoLogContext() throws Exception { try { SmartLog.finish(); } catch (Exception e) { Assertions.assertThat(e).hasMessage("Loggable context is absent"); } }