junit.framework.ComparisonFailure Java Examples

The following examples show how to use junit.framework.ComparisonFailure. 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: NestedFuncRepointTests.java    From Concurnas with MIT License 6 votes vote down vote up
private void runCompilation(String inputFile) throws Throwable
{
	String absSrcFilePath = SrcDir + File.separator + inputFile +".conc";
	
	//String expected = absSrcFilePath +".e";
	checkExists(absSrcFilePath);
	//File exp = checkExists(expected);
	
	MainLoop mainLoop = new MainLoop(SrcDir, new DirectFileLoader(), true, false, null, false);
	ArrayList<ErrorHolder> errs = mainLoop.compileFile(inputFile +".conc").messages;
	ComparisonFailure tf = null;
	assertNoPreBytecodeErrors(errs, true);
	
	PrintSourceVisitor codePrinter = new PrintSourceVisitor();
	
	Block b = mainLoop.getRootBlock();//note that we examine just the file we past, not all the related dependancies
	assertNotNull("Root block is null" , b);
	
	codePrinter.visit(b); 
	mainLoop.stop();
	String ret = Utils.listToString(codePrinter.items);
	System.out.println(ret);
}
 
Example #2
Source File: QueryTranslatorTestCase.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void assertTranslation(String hql, Map replacements) {
	ComparisonFailure cf = null;
	try {
		assertTranslation( hql, replacements, false, null );
	}
	catch ( ComparisonFailure e ) {
		e.printStackTrace();
		cf = e;
	}
	if ("false".equals(System.getProperty("org.hibernate.test.hql.SkipScalarQuery","false"))) {
		// Run the scalar translation anyway, even if there was a comparison failure.
		assertTranslation( hql, replacements, true, null );
	}
	if (cf != null)
		throw cf;
}
 
Example #3
Source File: AssertTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testAssertStringNotEqualsNull() {
	try {
		assertEquals("foo", null);
		fail();
	} catch (ComparisonFailure e) {
		e.getMessage(); // why no assertion?
	}
}
 
Example #4
Source File: ComparisonFailureData.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static String get(final Throwable assertion, final Map staticMap, final String fieldName) throws IllegalAccessException, NoSuchFieldException {
  String actual;
  if (assertion instanceof ComparisonFailure) {
    actual = (String)((Field)staticMap.get(ComparisonFailure.class)).get(assertion);
  }
  else if (assertion instanceof org.junit.ComparisonFailure) {
    actual = (String)((Field)staticMap.get(org.junit.ComparisonFailure.class)).get(assertion);
  }
  else {
    Field field = assertion.getClass().getDeclaredField(fieldName);
    field.setAccessible(true);
    actual = (String)field.get(assertion);
  }
  return actual;
}
 
Example #5
Source File: AbstractLombokLightCodeInsightTestCase.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void checkResultByFile(String expectedFile) throws IOException {
  try {
    myFixture.checkResultByFile(expectedFile, true);
  } catch (ComparisonFailure ex) {
    String actualFileText = myFixture.getFile().getText();
    actualFileText = actualFileText.replace("java.lang.", "");

    final String path = getTestDataPath() + "/" + expectedFile;
    String expectedFileText = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(path)));

    if (!expectedFileText.replaceAll("\\s+", "").equals(actualFileText.replaceAll("\\s+", ""))) {
      assertEquals(expectedFileText, actualFileText);
    }
  }
}
 
Example #6
Source File: RhnBaseTestCase.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Assert that the date <code>later</code> is after the date
 * <code>earlier</code>. The assertion succeeds if the dates
 * are equal. Both dates must be non-null.
 *
 * @param msg the message to print if the assertion fails
 * @param earlier the earlier date to compare
 * @param later the later date to compare
 */
public static void assertNotBefore(String msg, Date earlier, Date later) {
    assertNotNull(msg, earlier);
    assertNotNull(msg, later);
    if (earlier.after(later) && !earlier.equals(later)) {
        String e = DateFormat.getDateTimeInstance().format(earlier);
        String l = DateFormat.getDateTimeInstance().format(later);
        throw new ComparisonFailure(msg, e, l);
    }
}
 
Example #7
Source File: CompareResultNotAccepted.java    From stringbench with Apache License 2.0 5 votes vote down vote up
@Override
public Statement apply(final Statement base, Description description) {
	return new Statement() {
		
		@Override
		public void evaluate() throws Throwable {
			try {
				base.evaluate();
			} catch (ResultNotAcceptedException e) {
				throw new ComparisonFailure("unexpected result: ", e.getExpected().toString(), e.getActual().toString());
			}
			
		}
	};
}
 
Example #8
Source File: FailsWithMessageExtension.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void intercept(IMethodInvocation invocation) throws Throwable {
    try {
        invocation.proceed();
    } catch (Throwable t) {
        if (!annotation.type().isInstance(t)) {
            throw new WrongExceptionThrownError(annotation.type(), t);
        }
        if (!annotation.message().equals(t.getMessage())) {
            throw new ComparisonFailure("Unexpected message for exception.", annotation.message(), t.getMessage());
        }
        return;
    }

    throw new WrongExceptionThrownError(annotation.type(), null);
}
 
Example #9
Source File: FailsWithMessageExtension.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void intercept(IMethodInvocation invocation) throws Throwable {
    try {
        invocation.proceed();
    } catch (Throwable t) {
        if (!annotation.type().isInstance(t)) {
            throw new WrongExceptionThrownError(annotation.type(), t);
        }
        if (!annotation.message().equals(t.getMessage())) {
            throw new ComparisonFailure("Unexpected message for exception.", annotation.message(), t.getMessage());
        }
        return;
    }

    throw new WrongExceptionThrownError(annotation.type(), null);
}
 
Example #10
Source File: ComparisonFailureTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testThrowing() {
	try {
		assertEquals("a", "b");
	} catch (ComparisonFailure e) {
		return;
	}
	fail();
}
 
Example #11
Source File: JsonInputTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void rowWrittenEvent( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException {
  if ( rowNbr >= data.length ) {
    throw new ComparisonFailure( "too many output rows", "" + data.length, "" + ( rowNbr + 1 ) );
  } else {
    for ( int i = 0; i < data[ rowNbr ].length; i++ ) {
      try {
        boolean eq = true;
        if ( comparators.containsKey( i ) ) {
          Comparison<Object> comp = comparators.get( i );
          if ( comp != null ) {
            eq = comp.equals( data[ rowNbr ][ i ], row[ i ] );
          }
        } else {
          ValueMetaInterface valueMeta = rowMeta.getValueMeta( i );
          eq = valueMeta.compare( data[ rowNbr ][ i ], row[ i ] ) == 0;
        }
        if ( !eq ) {
          throw new ComparisonFailure( String.format( "Mismatch row %d, column %d", rowNbr, i ),
            rowMeta.getString( data[ rowNbr ] ), rowMeta.getString( row ) );
        }
      } catch ( Exception e ) {
        throw new AssertionError( String.format( "Value type at row %d, column %d", rowNbr, i ), e );
      }
    }
    rowNbr++;
  }
}
 
Example #12
Source File: AssertTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testAssertNullNotEqualsString() {
	try {
		assertEquals(null, "foo");
		fail();
	} catch (ComparisonFailure e) {
	}
}
 
Example #13
Source File: CompilerTest.java    From Moxy with MIT License 5 votes vote down vote up
/**
 * Asserts that all files from {@code exceptedGeneratedFiles} exists in {@code actualGeneratedFiles}
 * and have equivalent bytecode
 */
protected void assertExceptedFilesGenerated(List<JavaFileObject> actualGeneratedFiles, List<JavaFileObject> exceptedGeneratedFiles) throws Exception {
	for (JavaFileObject exceptedClass : exceptedGeneratedFiles) {
		final String fileName = exceptedClass.getName();

		JavaFileObject actualClass = actualGeneratedFiles.stream()
				.filter(input -> fileName.equals(input.getName()))
				.findFirst()
				.orElseThrow(() -> new AssertionFailedError("File " + fileName + " is not generated"));

		String actualBytecode = getBytecodeString(actualClass);
		String exceptedBytecode = getBytecodeString(exceptedClass);

		if (!exceptedBytecode.equals(actualBytecode)) {
			JavaFileObject actualSource = findSourceForClass(actualGeneratedFiles, fileName);

			throw new ComparisonFailure(Joiner.on('\n').join(
					"Bytecode for file " + fileName + " not equal to excepted",
					"",
					"Actual generated file (" + actualSource.getName() + "):",
					"================",
					"",
					actualSource.getCharContent(false),
					""
			), exceptedBytecode, actualBytecode);
		}
	}
}
 
Example #14
Source File: ContentAssistXpectMethod.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Unordered comparison: same number of required and proposed */
private void assertExactly(List<String> proposals, List<String> required,
		ICommaSeparatedValuesExpectation expectation) {

	// ensure, that there are not more proposals then required/expected
	// assert same length:
	if (proposals.size() != required.size())
		throw new ComparisonFailure(
				"System provides " + proposals.size() + " proposals, expected have been " + required.size() + ".",
				required.stream().collect(Collectors.joining(",")), proposals.stream().collect(
						Collectors.joining(",")));

	// ensure, that all required match a proposal.
	assertContainingMatchAll(proposals, required, expectation);
}
 
Example #15
Source File: ContentAssistXpectMethod.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void assertExactlyOrdered(List<String> proposals, List<String> required,
		CommaSeparatedValuesExpectationImpl expectation) {
	assertContainingMatchAllOrdered(proposals, required, expectation);

	// assert same length:
	if (proposals.size() != required.size())
		throw new ComparisonFailure(
				"Ambiguity: All required proposal (right side) could match the ones the system provides." +
						" But, at least two required labels matched the same proposal." +
						" Your requirement on the right side is to sloppy. Please provide more specific labels." +
						" See the full proposal display strings in the comparison",
				required.stream().collect(
						Collectors.joining(",")),
				proposals.stream().collect(Collectors.joining(",")));
}
 
Example #16
Source File: FailsWithMessageExtension.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void intercept(IMethodInvocation invocation) throws Throwable {
    try {
        invocation.proceed();
    } catch (Throwable t) {
        if (!annotation.type().isInstance(t)) {
            throw new WrongExceptionThrownError(annotation.type(), t);
        }
        if (!annotation.message().equals(t.getMessage())) {
            throw new ComparisonFailure("Unexpected message for exception.", annotation.message(), t.getMessage());
        }
        return;
    }

    throw new WrongExceptionThrownError(annotation.type(), null);
}
 
Example #17
Source File: FailsWithMessageExtension.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void intercept(IMethodInvocation invocation) throws Throwable {
    try {
        invocation.proceed();
    } catch (Throwable t) {
        if (!annotation.type().isInstance(t)) {
            throw new WrongExceptionThrownError(annotation.type(), t);
        }
        if (!annotation.message().equals(t.getMessage())) {
            throw new ComparisonFailure("Unexpected message for exception.", annotation.message(), t.getMessage());
        }
        return;
    }

    throw new WrongExceptionThrownError(annotation.type(), null);
}
 
Example #18
Source File: RhnBaseTestCase.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Assert that the date <code>later</code> is after the date
 * <code>earlier</code>. The assertion succeeds if the dates
 * are equal. Both dates must be non-null.
 *
 * @param msg the message to print if the assertion fails
 * @param earlier the earlier date to compare
 * @param later the later date to compare
 */
public static void assertNotBefore(String msg, Date earlier, Date later) {
    assertNotNull(msg, earlier);
    assertNotNull(msg, later);
    if (earlier.after(later) && !earlier.equals(later)) {
        String e = DateFormat.getDateTimeInstance().format(earlier);
        String l = DateFormat.getDateTimeInstance().format(later);
        throw new ComparisonFailure(msg, e, l);
    }
}
 
Example #19
Source File: JsonInputTest.java    From hop with Apache License 2.0 5 votes vote down vote up
@Override
public void rowWrittenEvent( IRowMeta rowMeta, Object[] row ) throws HopTransformException {
  if ( rowNbr >= data.length ) {
    throw new ComparisonFailure( "too many output rows", "" + data.length, "" + ( rowNbr + 1 ) );
  } else {
    for ( int i = 0; i < data[ rowNbr ].length; i++ ) {
      try {
        boolean eq = true;
        if ( comparators.containsKey( i ) ) {
          Comparison<Object> comp = comparators.get( i );
          if ( comp != null ) {
            eq = comp.equals( data[ rowNbr ][ i ], row[ i ] );
          }
        } else {
          IValueMeta valueMeta = rowMeta.getValueMeta( i );
          eq = valueMeta.compare( data[ rowNbr ][ i ], row[ i ] ) == 0;
        }
        if ( !eq ) {
          throw new ComparisonFailure( String.format( "Mismatch row %d, column %d", rowNbr, i ),
            rowMeta.getString( data[ rowNbr ] ), rowMeta.getString( row ) );
        }
      } catch ( Exception e ) {
        throw new AssertionError( String.format( "Value type at row %d, column %d", rowNbr, i ), e );
      }
    }
    rowNbr++;
  }
}
 
Example #20
Source File: TestUtilities.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Check the 2 lists comparing the rows in order. If they are not the same fail the test.
 * 
 * @param rows1
 *          set 1 of rows to compare
 * @param rows2
 *          set 2 of rows to compare
 * @param fileNameColumn
 *          Number of the column containing the filename. This is only checked for being non-null (some systems maybe
 *          canonize names differently than we input).
 */
public static void checkRows( List<RowMetaAndData> rows1, List<RowMetaAndData> rows2, int fileNameColumn )
  throws TestFailedException {

  int idx = 1;
  if ( rows1.size() != rows2.size() ) {
    throw new TestFailedException( "Number of rows is not the same: " + rows1.size() + " and " + rows2.size() );
  }
  Iterator<RowMetaAndData> itrRows1 = rows1.iterator();
  Iterator<RowMetaAndData> itrRows2 = rows2.iterator();

  while ( itrRows1.hasNext() && itrRows2.hasNext() ) {
    RowMetaAndData rowMetaAndData1 = itrRows1.next();
    RowMetaAndData rowMetaAndData2 = itrRows2.next();

    RowMetaInterface rowMetaInterface1 = rowMetaAndData1.getRowMeta();

    Object[] rowObject1 = rowMetaAndData1.getData();
    Object[] rowObject2 = rowMetaAndData2.getData();

    if ( rowMetaAndData1.size() != rowMetaAndData2.size() ) {
      throw new TestFailedException( "row number " + idx + " is not equal" );
    }

    int[] fields = new int[rowMetaInterface1.size()];
    for ( int ydx = 0; ydx < rowMetaInterface1.size(); ydx++ ) {
      fields[ydx] = ydx;
    }

    try {
      if ( fileNameColumn >= 0 ) {
        rowObject1[fileNameColumn] = rowObject2[fileNameColumn];
      }
      if ( rowMetaAndData1.getRowMeta().compare( rowObject1, rowObject2, fields ) != 0 ) {
        throw new ComparisonFailure( "row nr " + idx + " is not equal", rowMetaInterface1.getString( rowObject1 ),
            rowMetaInterface1.getString( rowObject2 ) );
      }
    } catch ( KettleValueException e ) {
      throw new TestFailedException( "row nr " + idx + " is not equal" );
    }
    idx++;
  }
}
 
Example #21
Source File: TestUtilities.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Check the 2 lists comparing the rows in order. If they are not the same fail the test.
 *
 * @param rows1          set 1 of rows to compare
 * @param rows2          set 2 of rows to compare
 * @param fileNameColumn Number of the column containing the filename. This is only checked for being non-null (some
 *                       systems maybe canonize names differently than we input).
 */
public static void checkRows( List<RowMetaAndData> rows1, List<RowMetaAndData> rows2, int fileNameColumn )
  throws TestFailedException {

  int idx = 1;
  if ( rows1.size() != rows2.size() ) {
    throw new TestFailedException( "Number of rows is not the same: " + rows1.size() + " and " + rows2.size() );
  }
  Iterator<RowMetaAndData> itrRows1 = rows1.iterator();
  Iterator<RowMetaAndData> itrRows2 = rows2.iterator();

  while ( itrRows1.hasNext() && itrRows2.hasNext() ) {
    RowMetaAndData rowMetaAndData1 = itrRows1.next();
    RowMetaAndData rowMetaAndData2 = itrRows2.next();

    RowMetaInterface rowMetaInterface1 = rowMetaAndData1.getRowMeta();

    Object[] rowObject1 = rowMetaAndData1.getData();
    Object[] rowObject2 = rowMetaAndData2.getData();

    if ( rowMetaAndData1.size() != rowMetaAndData2.size() ) {
      throw new TestFailedException( "row number " + idx + " is not equal" );
    }

    int[] fields = new int[ rowMetaInterface1.size() ];
    for ( int ydx = 0; ydx < rowMetaInterface1.size(); ydx++ ) {
      fields[ ydx ] = ydx;
    }

    try {
      if ( fileNameColumn >= 0 ) {
        rowObject1[ fileNameColumn ] = rowObject2[ fileNameColumn ];
      }
      if ( rowMetaAndData1.getRowMeta().compare( rowObject1, rowObject2, fields ) != 0 ) {
        throw new ComparisonFailure( "row nr " + idx + " is not equal",
        rowMetaInterface1.getString( rowObject1 ),
        rowMetaInterface1.getString( rowObject2 ) ); 
      }
    } catch ( KettleValueException e ) {
      throw new TestFailedException( "row nr " + idx + " is not equal" );
    }
    idx++;
  }
}
 
Example #22
Source File: CodeInsightTestFixtureImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void checkResult(final String expectedFile, final boolean stripTrailingSpaces, final SelectionAndCaretMarkupLoader loader, String actualText) {
  assertInitialized();
  Project project = getProject();
  PsiFile file = getFile();
  Editor editor = getEditor();
  if (editor instanceof EditorWindow) {
    editor = ((EditorWindow)editor).getDelegate();
    file = InjectedLanguageUtil.getTopLevelFile(file);
  }

  project.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  if (stripTrailingSpaces) {
    actualText = stripTrailingSpaces(actualText, project);
  }

  PsiDocumentManager.getInstance(project).commitAllDocuments();

  String newFileText1 = loader.newFileText;
  if (stripTrailingSpaces) {
    newFileText1 = stripTrailingSpaces(newFileText1, project);
  }

  actualText = StringUtil.convertLineSeparators(actualText);

  if (!Comparing.equal(newFileText1, actualText)) {
    if (loader.filePath != null) {
      throw new FileComparisonFailure(expectedFile, newFileText1, actualText, loader.filePath);
    }
    else {
      throw new ComparisonFailure(expectedFile, newFileText1, actualText);
    }
  }

  if (loader.caretMarker != null) {
    final int tabSize = CodeStyleSettingsManager.getSettings(getProject()).getIndentOptions(InternalStdFileTypes.JAVA).TAB_SIZE;

    int caretLine = StringUtil.offsetToLineNumber(loader.newFileText, loader.caretMarker.getStartOffset());
    int caretCol = EditorUtil
            .calcColumnNumber(null, loader.newFileText, StringUtil.lineColToOffset(loader.newFileText, caretLine, 0), loader.caretMarker.getStartOffset(),
                              tabSize);

    final int actualLine = editor.getCaretModel().getLogicalPosition().line;
    final int actualCol = editor.getCaretModel().getLogicalPosition().column;
    boolean caretPositionEquals = caretLine == actualLine && caretCol == actualCol;
    Assert.assertTrue("Caret position in " + expectedFile + " differs. Expected " + genCaretPositionPresentation(caretLine, caretCol) +
                      ". Actual " + genCaretPositionPresentation(actualLine, actualCol), caretPositionEquals);
  }

  if (loader.selStartMarker != null && loader.selEndMarker != null) {
    int selStartLine = StringUtil.offsetToLineNumber(loader.newFileText, loader.selStartMarker.getStartOffset());
    int selStartCol = loader.selStartMarker.getStartOffset() - StringUtil.lineColToOffset(loader.newFileText, selStartLine, 0);

    int selEndLine = StringUtil.offsetToLineNumber(loader.newFileText, loader.selEndMarker.getEndOffset());
    int selEndCol = loader.selEndMarker.getEndOffset() - StringUtil.lineColToOffset(loader.newFileText, selEndLine, 0);

    int selectionStart;
    int selectionEnd;
    selectionStart = editor.getSelectionModel().getSelectionStart();
    selectionEnd = editor.getSelectionModel().getSelectionEnd();

    final int selStartLineActual = StringUtil.offsetToLineNumber(loader.newFileText, selectionStart);
    final int selStartColActual = selectionStart - StringUtil.lineColToOffset(loader.newFileText, selStartLineActual, 0);

    final int selEndLineActual = StringUtil.offsetToLineNumber(loader.newFileText, selectionEnd);
    final int selEndColActual = selectionEnd - StringUtil.lineColToOffset(loader.newFileText, selEndLineActual, 0);

    final boolean selectionEquals = selStartCol == selStartColActual &&
                                    selStartLine == selStartLineActual &&
                                    selEndCol == selEndColActual &&
                                    selEndLine == selEndLineActual;
    Assert.assertTrue("selection in " + expectedFile +
                      " differs. Expected " + genSelectionPresentation(selStartLine, selStartCol, selEndLine, selEndCol) +
                      ". Actual " + genSelectionPresentation(selStartLineActual, selStartColActual, selEndLineActual, selEndColActual), selectionEquals);
  }
  else if (editor != null) {
    Assert.assertTrue("has no selection in " + expectedFile, !editor.getSelectionModel().hasSelection());
  }
}
 
Example #23
Source File: RestServiceScriptsIT.java    From sql-layer with GNU Affero General Public License v3.0 4 votes vote down vote up
private String diff(String a, String b) {
    return new ComparisonFailure("", a, b).getMessage();
}
 
Example #24
Source File: ComparisonFailureTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void testConnection() {
	ComparisonFailure failure= new ComparisonFailure("warning", "Mary had a little lamb", "Mary had the little lamb");
	assertEquals("warning expected:<Mary had [a] little lamb> but was:<Mary had [the] little lamb>", failure.getMessage());
}
 
Example #25
Source File: TestUtilities.java    From hop with Apache License 2.0 4 votes vote down vote up
/**
 * Check the 2 lists comparing the rows in order. If they are not the same fail the test.
 * 
 * @param rows1
 *          set 1 of rows to compare
 * @param rows2
 *          set 2 of rows to compare
 * @param fileNameColumn
 *          Number of the column containing the filename. This is only checked for being non-null (some systems maybe
 *          canonize names differently than we input).
 */
public static void checkRows( List<RowMetaAndData> rows1, List<RowMetaAndData> rows2, int fileNameColumn )
  throws TestFailedException {

  int idx = 1;
  if ( rows1.size() != rows2.size() ) {
    throw new TestFailedException( "Number of rows is not the same: " + rows1.size() + " and " + rows2.size() );
  }
  Iterator<RowMetaAndData> itrRows1 = rows1.iterator();
  Iterator<RowMetaAndData> itrRows2 = rows2.iterator();

  while ( itrRows1.hasNext() && itrRows2.hasNext() ) {
    RowMetaAndData rowMetaAndData1 = itrRows1.next();
    RowMetaAndData rowMetaAndData2 = itrRows2.next();

    IRowMeta rowMetaInterface1 = rowMetaAndData1.getRowMeta();

    Object[] rowObject1 = rowMetaAndData1.getData();
    Object[] rowObject2 = rowMetaAndData2.getData();

    if ( rowMetaAndData1.size() != rowMetaAndData2.size() ) {
      throw new TestFailedException( "row number " + idx + " is not equal" );
    }

    int[] fields = new int[rowMetaInterface1.size()];
    for ( int ydx = 0; ydx < rowMetaInterface1.size(); ydx++ ) {
      fields[ydx] = ydx;
    }

    try {
      if ( fileNameColumn >= 0 ) {
        rowObject1[fileNameColumn] = rowObject2[fileNameColumn];
      }
      if ( rowMetaAndData1.getRowMeta().compare( rowObject1, rowObject2, fields ) != 0 ) {
        throw new ComparisonFailure( "row nr " + idx + " is not equal", rowMetaInterface1.getString( rowObject1 ),
            rowMetaInterface1.getString( rowObject2 ) );
      }
    } catch ( HopValueException e ) {
      throw new TestFailedException( "row nr " + idx + " is not equal" );
    }
    idx++;
  }
}