Package junit.framework

Examples of junit.framework.ComparisonFailure


  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


    {
      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

    try {
      new CheckEscapingSanityVisitor().exec(soyTree);
      rewrittenSource(soyTree);
    } catch (SoyAutoescapeException ex) {
      if (msg != null && !msg.equals(ex.getMessage())) {
        throw (ComparisonFailure) new ComparisonFailure("", msg, ex.getMessage()).initCause(ex);
      }
      return;
    }
    fail("Expected failure but was " + soyTree.getChild(0).toSourceString());
  }
View Full Code Here

             && areEqual(i.previous(), j.previous())) {
        ++commonSuffix;
      }
    }

    throw new ComparisonFailure(
        "Expected: {{{\n"
        + snippet(expected,
                  Math.max(commonPrefix - diffContext, 0),
                  Math.min(m, m - commonSuffix + diffContext), 84)
        + "\n}}} != {{{\n"
View Full Code Here

        if (!example.getExcelRendering().equals(actual)) {
          failureCount++;
          String msg = "Error rendering for examples[" + i + "] "
              + formatExample(example) + " "
              + " bad-result='" + actual + "' "
              + new ComparisonFailure(null, example.getExcelRendering(), actual).getMessage();
          System.err.println(msg);
          continue;
        }
      } catch (RuntimeException e) {
        failureCount++;
View Full Code Here

    assertEquals(originalPtgs.length, convertedPtgs.length);
    for (int i = 0; i < convertedPtgs.length; i++) {
      Ptg originalPtg = originalPtgs[i];
      Ptg convertedPtg = convertedPtgs[i];
      if (originalPtg.getPtgClass() != convertedPtg.getPtgClass()) {
        throw new ComparisonFailure("Different operand class for token[" + i + "]",
            String.valueOf(originalPtg.getPtgClass()), String.valueOf(convertedPtg.getPtgClass()));
      }
    }
  }
View Full Code Here

   */
  private static void assertDouble(double a, double b) {
    long bitsA = Double.doubleToLongBits(a);
    long bitsB = Double.doubleToLongBits(b);
    if (bitsA != bitsB) {
      throw new ComparisonFailure("value different to expected",
          new String(HexDump.longToHex(bitsA)), new String(HexDump.longToHex(bitsB)));
    }
  }
View Full Code Here

        }

        if ( expectedKeys.length != actualResults.size() )
        {
            dumpResults( actualResults );
            throw new ComparisonFailure( "Results count", String.valueOf( expectedKeys.length ), String
                .valueOf( actualResults.size() ) );
        }

        assertEquals( "Results count", expectedKeys.length, actualResults.size() );
View Full Code Here

     * is correctly reported as a failure and not as an error in the Test
     * Runner when Cactus is used.
     */
    public void testComparisonFailure()
    {
        throw new ComparisonFailure("test comparison failure", "some value",
            "other value");
    }
View Full Code Here

     * is correctly reported as a failure and not as an error in the Test
     * Runner when Cactus is used.
     */
    public void testComparisonFailure()
    {
        throw new ComparisonFailure("test comparison failure", "some value",
            "other value");
    }
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.