junit.framework.Assert.failNotEquals()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中junit.framework.Assert.failNotEquals()方法的一些代码示例,展示了Assert.failNotEquals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.failNotEquals()方法的具体详情如下:
包路径:junit.framework.Assert
类名称:Assert
方法名:failNotEquals

Assert.failNotEquals介绍

暂无

代码示例

代码示例来源:origin: junit-team/junit4

public static void failNotEquals(String message, Object expected, Object actual) {
  Assert.failNotEquals(message, expected, actual);
}

代码示例来源:origin: google/j2objc

@SuppressWarnings("deprecation")
public static void failNotEquals(String message, Object expected, Object actual) {
  Assert.failNotEquals(message, expected, actual);
}

代码示例来源:origin: junit-team/junit4

/**
 * Asserts that two objects are equal. If they are not
 * an AssertionFailedError is thrown with the given message.
 */
static public void assertEquals(String message, Object expected, Object actual) {
  if (expected == null && actual == null) {
    return;
  }
  if (expected != null && expected.equals(actual)) {
    return;
  }
  failNotEquals(message, expected, actual);
}

代码示例来源:origin: google/j2objc

/**
 * Asserts that two objects are equal. If they are not
 * an AssertionFailedError is thrown with the given message.
 */
static public void assertEquals(String message, Object expected, Object actual) {
  if (expected == null && actual == null) {
    return;
  }
  if (expected != null && expected.equals(actual)) {
    return;
  }
  failNotEquals(message, expected, actual);
}

代码示例来源:origin: junit-team/junit4

/**
 * Asserts that two doubles are equal concerning a delta.  If they are not
 * an AssertionFailedError is thrown with the given message.  If the expected
 * value is infinity then the delta value is ignored.
 */
static public void assertEquals(String message, double expected, double actual, double delta) {
  if (Double.compare(expected, actual) == 0) {
    return;
  }
  if (!(Math.abs(expected - actual) <= delta)) {
    failNotEquals(message, new Double(expected), new Double(actual));
  }
}

代码示例来源:origin: junit-team/junit4

/**
 * Asserts that two floats are equal concerning a positive delta. If they
 * are not an AssertionFailedError is thrown with the given message. If the
 * expected value is infinity then the delta value is ignored.
 */
static public void assertEquals(String message, float expected, float actual, float delta) {
  if (Float.compare(expected, actual) == 0) {
    return;
  }
  if (!(Math.abs(expected - actual) <= delta)) {
    failNotEquals(message, new Float(expected), new Float(actual));
  }
}

代码示例来源:origin: google/j2objc

/**
 * Asserts that two doubles are equal concerning a delta.  If they are not
 * an AssertionFailedError is thrown with the given message.  If the expected
 * value is infinity then the delta value is ignored.
 */
static public void assertEquals(String message, double expected, double actual, double delta) {
  if (Double.compare(expected, actual) == 0) {
    return;
  }
  if (!(Math.abs(expected - actual) <= delta)) {
    failNotEquals(message, new Double(expected), new Double(actual));
  }
}

代码示例来源:origin: google/j2objc

/**
 * Asserts that two floats are equal concerning a positive delta. If they
 * are not an AssertionFailedError is thrown with the given message. If the
 * expected value is infinity then the delta value is ignored.
 */
static public void assertEquals(String message, float expected, float actual, float delta) {
  if (Float.compare(expected, actual) == 0) {
    return;
  }
  if (!(Math.abs(expected - actual) <= delta)) {
    failNotEquals(message, new Float(expected), new Float(actual));
  }
}

代码示例来源:origin: h2oai/h2o-2

void compareVal(double a, double b, double abseps, double releps) {
 // check for equality
 if (Double.compare(a, b) == 0) {
 }
 // check for small relative error
 else if (Math.abs((a-b)/Math.max(a,b)) < releps) {
 }
 // check for small absolute error
 else if (Math.abs(a - b) <= abseps) {
 }
 // fail
 else Assert.failNotEquals("Not equal: ", a, b);
}

代码示例来源:origin: h2oai/h2o-2

void compareVal(double a, double b, double abseps, double releps) {
 // check for equality
 if (Double.compare(a, b) == 0) {
 }
 // check for small relative error
 else if (Math.abs(a-b)/Math.max(a,b) < releps) {
 }
 // check for small absolute error
 else if (Math.abs(a - b) <= abseps) {
 }
 // fail
 else Assert.failNotEquals("Not equal: ", new Double(a), new Double(b));
}

代码示例来源:origin: facebook/facebook-android-sdk

@TargetApi(16)
public static void assertEquals(final JSONArray expected, final JSONArray actual) {
  // JSONObject.equals does not do an order-independent comparison, so let's roll our own  :(
  if (areEqual(expected, actual)) {
    return;
  }
  Assert.failNotEquals("", expected, actual);
}

代码示例来源:origin: facebook/facebook-android-sdk

@TargetApi(16)
public static void assertEquals(final JSONObject expected, final JSONObject actual) {
  // JSONObject.equals does not do an order-independent comparison, so let's roll our own  :(
  if (areEqual(expected, actual)) {
    return;
  }
  Assert.failNotEquals("", expected, actual);
}

代码示例来源:origin: h2oai/h2o-2

void compareVal(float a, float b, float abseps, float releps) {
  // check for equality
  if (Float.compare(a, b) == 0) {
  }
  // check for small relative error
  else if (Math.abs(a-b)/Math.max(a,b) < releps) {
  }
  // check for small absolute error
  else if (Math.abs(a - b) <= abseps) {
  }
  // fail
  else {
//      Log.err("Not close enough: " + a + " " + b);
   Assert.failNotEquals("Not equal: ", a, b);
  }
 }

代码示例来源:origin: goldmansachs/gs-collections

public static void assertListsEqual(String listName, List<?> expectedList, List<?> actualList)
{
  try
  {
    if (expectedList == null && actualList == null)
    {
      return;
    }
    Assert.assertNotNull(expectedList);
    Assert.assertNotNull(actualList);
    Assert.assertEquals(listName + " size", expectedList.size(), actualList.size());
    for (int index = 0; index < actualList.size(); index++)
    {
      Object eachExpected = expectedList.get(index);
      Object eachActual = actualList.get(index);
      if (!Comparators.nullSafeEquals(eachExpected, eachActual))
      {
        junit.framework.Assert.failNotEquals(listName + " first differed at element [" + index + "];", eachExpected, eachActual);
      }
    }
  }
  catch (AssertionError e)
  {
    Verify.throwMangledException(e);
  }
}

代码示例来源:origin: eclipse/eclipse-collections

public static void assertListsEqual(String listName, List<?> expectedList, List<?> actualList)
{
  try
  {
    if (expectedList == null && actualList == null)
    {
      return;
    }
    Assert.assertNotNull(expectedList);
    Assert.assertNotNull(actualList);
    Assert.assertEquals(listName + " size", expectedList.size(), actualList.size());
    for (int index = 0; index < actualList.size(); index++)
    {
      Object eachExpected = expectedList.get(index);
      Object eachActual = actualList.get(index);
      if (!Comparators.nullSafeEquals(eachExpected, eachActual))
      {
        junit.framework.Assert.failNotEquals(listName + " first differed at element [" + index + "];", eachExpected, eachActual);
      }
    }
  }
  catch (AssertionError e)
  {
    Verify.throwMangledException(e);
  }
}

代码示例来源:origin: goldmansachs/gs-collections

junit.framework.Assert.failNotEquals(iterableName + " first differed at element [" + index + "];", eachExpected, eachActual);

代码示例来源:origin: eclipse/eclipse-collections

junit.framework.Assert.failNotEquals(iterableName + " first differed at element [" + index + "];", eachExpected, eachActual);

代码示例来源:origin: goldmansachs/gs-collections

junit.framework.Assert.failNotEquals(message, inExpectedOnlySet, inActualOnlySet);

代码示例来源:origin: eclipse/eclipse-collections

junit.framework.Assert.failNotEquals(message, inExpectedOnlySet, inActualOnlySet);

代码示例来源:origin: camunda/camunda-bpm-platform

@SuppressWarnings("deprecation")
public static void failNotEquals(String message, Object expected, Object actual) {
  Assert.failNotEquals(message, expected, actual);
}

相关文章