Package junit.framework

Examples of junit.framework.ComparisonFailure


                  + expected.getClass().getName()
                );
            }
        }
        catch (ClassCastException ex) {
            throw new ComparisonFailure(message
              + "; Mismatched node types: "
              + expected.getClass().getName() + " != "
              + actual.getClass().getName(),
              expected.toXML(), actual.toXML());
        }
View Full Code Here


    */
   public static void assertEqual(Object[] expectedArray, Object[] actualArray)
   {
      if (!Arrays.equals(expectedArray, actualArray))
      {
         throw new ComparisonFailure("Arrays do not match", Arrays.toString(expectedArray), Arrays.toString(actualArray));
      }
   }
View Full Code Here

                                     String[] actual) {
        if ((expected == null) && (actual == null)) {
            return;
        }
        if (expected.length != actual.length) {
            throw new ComparisonFailure(message,
                                        expected.toString(),
                                        actual.toString());
        }
        for (int i = 0; i < expected.length; i++) {
            assertEquals(expected[i], actual[i]);
View Full Code Here

            throw new AssertionFailedError("Parameter [" + paramName + "] not found");
        }
       
        if (value instanceof String) {
            if (!paramValue.equals(value)) {
                throw new ComparisonFailure("Incorrect value found",
                        paramValue, (String) value);
            }
        } else if (value instanceof String[]) {
            // see if our value is among those in the array
            String[] values = (String[]) value;
View Full Code Here

      // TODO: encoding???
      outputContent = new String(outputStream.toByteArray());
    }

    if (!((outputContent.indexOf(string) >= 0) ^ (!contains))) {
      throw new ComparisonFailure("Contains check failed", string, outputContent);
    }
  }
View Full Code Here

  public void assertTranslation(String hql, boolean scalar) throws QueryException, MappingException {
    assertTranslation( hql, null, scalar, null );
  }

  protected void assertTranslation(String hql, Map replacements) {
    ComparisonFailure cf = null;
    try {
      assertTranslation( hql, replacements, false, null );
    }
    catch ( ComparisonFailure e ) {
      e.printStackTrace();
View Full Code Here

public class JUnitFailureFactory implements FailureFactory
{
    public Error createFailure(String message, String expected, String actual)
    {
        // Return the junit.framework.ComparisonFailure object
        return new ComparisonFailure(message, expected, actual);
    }
View Full Code Here

          }
        }
      catch( AssertionFailedError exception )
        {
        LOG.error( "actual error", exception );
        throw new ComparisonFailure( "tuples not equal", lhsTuple.toString(), rhsTuple.toString() );
        }
      }
    }
View Full Code Here

            }
        } catch (Throwable e) {
            String msg = "";

            if (e instanceof ComparisonFailure) {
                ComparisonFailure cf = (ComparisonFailure) e;
                String expected = cf.getExpected();
                String actual = cf.getActual();

                // if( expected.length() > ERROR_LENGTH_LIMIT )
                // expected = expected.substring(0, ERROR_LENGTH_LIMIT) + "..";
                //
                // if( actual.length() > ERROR_LENGTH_LIMIT )
View Full Code Here

     * @param wildcard
     * @throws ComparisonFailure
     */
    public static void assertSimilar(String expected, String real, char wildcard) throws ComparisonFailure {
        if (!isSimilar(expected, real, wildcard)) {
            throw new ComparisonFailure("Not matched", expected, real);
        }
    }
View Full Code Here

TOP

Related Classes of junit.framework.ComparisonFailure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.