module Minitest::ErrorOnWarning

def warn message, category: nil

:nodoc:
def warn message, category: nil
  message = "[#{category}] #{message}" if category
  raise UnexpectedWarning, message
end