@Override public boolean equals(Object obj) { return (obj instanceof HostConfigurableSocketFactory) && EqualsHelper.nullSafeEquals(this.host, ((HostConfigurableSocketFactory) obj).host); }
public void testStreamsEqual() throws Exception { InputStream isLeft = new FileInputStream(fileOne); InputStream isRight = new FileInputStream(fileOne); boolean equal = EqualsHelper.binaryStreamEquals(isLeft, isRight); assertTrue("Should be the same", equal); }
/** * Utility method to compare a 'results' map with a map of expected values */ private void checkAuditMaps(Map<String, Serializable> result, Map<String, Serializable> expected) { String failure = EqualsHelper.getMapDifferenceReport(result, expected); if (failure != null) { fail(failure); } }
Map<Integer, MapValueComparison> diff = EqualsHelper.getMapComparison(left, right); assertEquals("'EQUAL' check failed", MapValueComparison.EQUAL, diff.get(0)); assertEquals("'NOT_EQUAL' check failed", MapValueComparison.NOT_EQUAL, diff.get(1));
public void testStreamsNotEqual() throws Exception { InputStream isLeft = new FileInputStream(fileOne); InputStream isRight = new FileInputStream(fileTwo); boolean equal = EqualsHelper.binaryStreamEquals(isLeft, isRight); assertFalse("Should not be the same", equal); }
String diff = EqualsHelper.getMapDifferenceReport(outputMap, expectedOutputMap); if (diff != null)
newProps = nodePropertyHelper.convertToPublicProperties(newPropsRaw); Map<QName, MapValueComparison> diff = EqualsHelper.getMapComparison( oldProps, newProps);
@Override public boolean equals(Object obj) { return (obj instanceof HostConfigurableSocketFactory) && EqualsHelper.nullSafeEquals(this.host, ((HostConfigurableSocketFactory) obj).host); }
boolean retVal = EqualsHelper.binaryStreamEquals(leftIs, rightIs); rightIs = null; leftIs = null;
public Void execute() throws Throwable { String diffReport; // Convert to raw and back Map<NodePropertyKey, NodePropertyValue> rawProps1 = helper.convertToPersistentProperties(in); Map<QName, Serializable> props1 = helper.convertToPublicProperties(rawProps1); // We can't be sure that we have what we started with, because there may have been // some mandatory conversions to the types defined by the model i.e. the values // will get converted to the dictionary type rather than the incoming type if (exact) { diffReport = EqualsHelper.getMapDifferenceReport(props1, in); assertNull(diffReport, diffReport); } // Convert back to raw again Map<NodePropertyKey, NodePropertyValue> rawProps2 = helper.convertToPersistentProperties(in); diffReport = EqualsHelper.getMapDifferenceReport(rawProps2, rawProps1); assertNull(diffReport, diffReport); // But now, on the second time out, we expect to get exactly what we got before Map<QName, Serializable> props2 = helper.convertToPublicProperties(rawProps2); diffReport = EqualsHelper.getMapDifferenceReport(props2, props1); assertNull(diffReport, diffReport); return null; } };
newProps = nodePropertyHelper.convertToPublicProperties(newPropsRaw); Map<QName, MapValueComparison> diff = EqualsHelper.getMapComparison( oldProps, newProps);
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof CustomProperties)) { return false; } CustomProperties other = (CustomProperties) obj; return EqualsHelper.nullSafeEquals(this.name, other.name); }
boolean retVal = EqualsHelper.binaryStreamEquals(leftIs, rightIs); rightIs = null; leftIs = null;
expected.put("/" + APPLICATION_THREE + "/transaction/type", "cm:content"); String failure = EqualsHelper.getMapDifferenceReport(recordedAuditMap, expected); if (failure != null)
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof CustomProperties)) { return false; } CustomProperties other = (CustomProperties) obj; return EqualsHelper.nullSafeEquals(this.name, other.name); }
try return EqualsHelper.binaryStreamEquals(leftIs, rightIs);
/** * Convenience getter to interpret the {@link #EMPTY_LOCALNAME_SUBSTITUTE} */ public String getLocalNameSafe() { if (EqualsHelper.nullSafeEquals(localName, QNameEntity.EMPTY_LOCALNAME_SUBSTITUTE)) { return ""; } else { return localName; } } /**
try return EqualsHelper.binaryStreamEquals(leftIs, rightIs);
/** * Convenience getter to interpret the {@link QName#EMPTY_URI_SUBSTITUTE} */ public String getUriSafe() { if (EqualsHelper.nullSafeEquals(uri, QName.EMPTY_URI_SUBSTITUTE)) { return ""; } else { return uri; } } /**
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || !(other instanceof Pair<?, ?>)) { return false; } Pair<?, ?> o = (Pair<?, ?>)other; return EqualsHelper.nullSafeEquals(this.first, o.first) && EqualsHelper.nullSafeEquals(this.second, o.second); }