Java Code Examples for junit.framework.Assert#failNotEquals()

The following examples show how to use junit.framework.Assert#failNotEquals() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: h2o-2   File: DeepLearningVsNeuralNet.java    License: Apache License 2.0 6 votes vote down vote up
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);
    }
  }
 
Example 2
Source Project: hop   File: ValueMetaStringTest.java    License: Apache License 2.0 5 votes vote down vote up
private static void assertSignum( String msg, int expected, int actual ) {
  if ( expected < 0 ) {
    if ( actual >= 0 ) {
      Assert.failNotEquals( msg, "(<0)", actual );
    }
  } else if ( expected > 0 ) {
    if ( actual <= 0 ) {
      Assert.failNotEquals( msg, "(>0)", actual );
    }
  } else {
    assertEquals( msg, expected, actual );
  }
}
 
Example 3
Source Project: h2o-2   File: DeepLearningIrisTest.java    License: Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source Project: h2o-2   File: NeuralNetIrisTest.java    License: Apache License 2.0 5 votes vote down vote up
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));
}
 
Example 5
private static void assertSignum( String msg, int expected, int actual ) {
  if ( expected < 0 ) {
    if ( actual >= 0 ) {
      Assert.failNotEquals( msg, "(<0)", actual );
    }
  } else if ( expected > 0 ) {
    if ( actual <= 0 ) {
      Assert.failNotEquals( msg, "(>0)", actual );
    }
  } else {
    assertEquals( msg, expected, actual );
  }
}
 
Example 6
Source Project: JTAF-XCore   File: IgnoreErrorsAssert.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Calls the Assert classes failNotEquals method which creates an exception
 * using the given message and objects
 * 
 * @param message
 *            message to be thrown if they are the same
 * @param expected
 *            expected object
 * @param actual
 *            actual object that is being checked
 */
@SuppressWarnings("deprecation")
public void failNotEquals(String message, Object expected, Object actual) {
    try {
        Assert.failNotEquals(message, expected, actual);
    } catch (Throwable e) {
        ea.addError(e);
    }
}