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

The following examples show how to use junit.framework.Assert#failNotEquals() . 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 check out the related API usage on the sidebar.
Example 1
Source File: DeepLearningVsNeuralNet.java    From h2o-2 with 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 File: ValueMetaStringTest.java    From hop with 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 File: DeepLearningIrisTest.java    From h2o-2 with 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 File: NeuralNetIrisTest.java    From h2o-2 with 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
Source File: ValueMetaStringTest.java    From pentaho-kettle with 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 6
Source File: IgnoreErrorsAssert.java    From JTAF-XCore with 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);
    }
}