<commit_before>/*
 * Ported from https://github.com/junit-team/junit
 */
package org.junit

import org.junit.internal.InexactComparisonCriteria
import org.junit.internal.ExactComparisonCriteria
import org.hamcrest.Matcher
import org.hamcrest.MatcherAssert

object Assert {
  @noinline
  def assertTrue(message: String, condition: Boolean): Unit = {
    if (!condition)
      fail(message)
  }

  @noinline
  def assertTrue(condition: Boolean): Unit =
    assertTrue(null, condition)

  @noinline
  def assertFalse(message: String, condition: Boolean): Unit =
    assertTrue(message, !condition)

  @noinline
  def assertFalse(condition: Boolean): Unit =
    assertFalse(null, condition)

  @noinline
  def fail(message: String): Unit =
    if (message eq null) throw new AssertionError()
    else throw new AssertionError(message)

  @noinline
  def fail(): Unit =
    fail(null)

  @noinline
  def assertEquals(message: String, expected: Any, actual: Any): Unit = {
    if (!equalsRegardingNull(expected, actual)) {
      (expected, actual) match {
        case (expectedString: String, actualString: String) =>
          val cleanMsg: String = if (message == null) "" else message
          throw new ComparisonFailure(cleanMsg, expectedString, actualString)

        case _ =>
          failNotEquals(message, expected, actual)
      }
    }
  }

  @inline
  private def equalsRegardingNull(expected: Any, actual: Any): Boolean =
    if (expected == null) actual == null
    else isEquals(expected, actual)

  @inline
  private def isEquals(expected: Any, actual: Any): Boolean =
    expected.equals(actual)

  @noinline
  def assertEquals(expected: Any, actual: Any): Unit =
    assertEquals(null, expected, actual)

  @noinline
  def assertNotEquals(message: String, unexpected: Any, actual: Any): Unit = {
    if (equalsRegardingNull(unexpected, actual))
      failEquals(message, actual)
  }

  @noinline
  def assertNotEquals(unexpected: Any, actual: Any): Unit =
    assertNotEquals(null, unexpected, actual)<commit_msg>Use `ju.Objects.equals` in `junit.Assert`.<commit_after>/*
 * Ported from https://github.com/junit-team/junit
 */
package org.junit

import java.util.Objects

import org.junit.internal.InexactComparisonCriteria
import org.junit.internal.ExactComparisonCriteria
import org.hamcrest.Matcher
import org.hamcrest.MatcherAssert

object Assert {
  @noinline
  def assertTrue(message: String, condition: Boolean): Unit = {
    if (!condition)
      fail(message)
  }

  @noinline
  def assertTrue(condition: Boolean): Unit =
    assertTrue(null, condition)

  @noinline
  def assertFalse(message: String, condition: Boolean): Unit =
    assertTrue(message, !condition)

  @noinline
  def assertFalse(condition: Boolean): Unit =
    assertFalse(null, condition)

  @noinline
  def fail(message: String): Unit =
    if (message eq null) throw new AssertionError()
    else throw new AssertionError(message)

  @noinline
  def fail(): Unit =
    fail(null)

  @noinline
  def assertEquals(message: String, expected: Any, actual: Any): Unit = {
    if (!Objects.equals(expected, actual)) {
      (expected, actual) match {
        case (expectedString: String, actualString: String) =>
          val cleanMsg: String = if (message == null) "" else message
          throw new ComparisonFailure(cleanMsg, expectedString, actualString)

        case _ =>
          failNotEquals(message, expected, actual)
      }
    }
  }

  @noinline
  def assertEquals(expected: Any, actual: Any): Unit =
    assertEquals(null, expected, actual)

  @noinline
  def assertNotEquals(message: String, unexpected: Any, actual: Any): Unit = {
    if (Objects.equals(unexpected, actual))
      failEquals(message, actual)
  }

  @noinline
  def assertNotEquals(unexpected: Any, actual: Any): Unit =
    assertNotEquals(null, unexpected, actual)
{'fraction_non_alphanumeric': 0.10674303566779485, 'fraction_numerical': 0.0, 'mean_word_length': 3.8085106382978724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5101953', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1090, 'n_words': 311}