@SuppressWarnings("deprecation") protected static void checkSettingsEqual( JDOMExternalizable expected, JDOMExternalizable settings, String message) throws Exception { if (expected == null || settings == null) return; Element oldS = new Element("temp"); expected.writeExternal(oldS); Element newS = new Element("temp"); settings.writeExternal(newS); String newString = JDOMUtil.writeElement(newS, "\n"); String oldString = JDOMUtil.writeElement(oldS, "\n"); Assert.assertEquals(message, oldString, newString); }
@SuppressWarnings({"deprecation", "Duplicates"}) public static void addChildren( @NotNull Element parent, @NotNull String childElementName, @NotNull Collection<? extends JDOMExternalizable> children) throws WriteExternalException { for (JDOMExternalizable child : children) { if (child != null) { Element element = new Element(childElementName); child.writeExternal(element); parent.addContent(element); } } }
@SuppressWarnings({"HardCodedStringLiteral"}) public static boolean externalizableEqual(JDOMExternalizable e1, JDOMExternalizable e2) { Element root1 = new Element("root"); Element root2 = new Element("root"); try { e1.writeExternal(root1); } catch (WriteExternalException e) { LOG.debug(e); } try { e2.writeExternal(root2); } catch (WriteExternalException e) { LOG.debug(e); } return elementsEqual(root1, root2); }