1 package org.junit.internal; 2 3 import org.junit.Assert; 4 5 public class InexactComparisonCriteria extends ComparisonCriteria { 6 public Object fDelta; 7 8 public InexactComparisonCriteria(double delta) { 9 fDelta = delta; 10 } 11 12 public InexactComparisonCriteria(float delta) { 13 fDelta = delta; 14 } 15 16 @Override 17 protected void assertElementsEqual(Object expected, Object actual) { 18 if (expected instanceof Double) { 19 Assert.assertEquals((Double) expected, (Double) actual, (Double) fDelta); 20 } else { 21 Assert.assertEquals((Float) expected, (Float) actual, (Float) fDelta); 22 } 23 } 24 }