code: public static void holdsLock(Object lock, Supplier<String> message) {
      if (isNotLockHolder(lock)) {
        throw new IllegalMonitorStateException(message.get());
      }
    }
docs: Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}.
  
  The assertion holds if and only if the {@link Object lock} is not {@literal null}
  and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}.
  
  @param lock {@link Object} used as the lock, monitor or mutex in the synchronization.
  @param message {@link Supplier} containing the message used in the {@link IllegalMonitorStateException} thrown
  if the assertion fails.
  @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread}
  does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}.
  @see java.lang.Thread#holdsLock(Object)
  @see java.util.function.Supplier