Skip to content

Instantly share code, notes, and snippets.

@abreslav
Created June 5, 2012 10:10
Show Gist options
  • Save abreslav/2874147 to your computer and use it in GitHub Desktop.
Save abreslav/2874147 to your computer and use it in GitHub Desktop.
public static void compareNamespaces(@NotNull NamespaceDescriptor nsa, @NotNull NamespaceDescriptor nsb, boolean includeObject,
@NotNull File txtFile) {
String serialized = new NamespaceComparator(includeObject).doCompareNamespaces(nsa, nsb);
try {
if (!txtFile.exists()) {
FileUtil.writeToFile(txtFile, serialized);
Assert.fail("Expected data file did not exist. Generating: " + txtFile);
}
String expected = FileUtil.loadFile(txtFile);
// compare with hardcopy: make sure nothing is lost in output
Assert.assertEquals(expected, serialized);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment