/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Compares actual and other with standard strategy (null safe equals check). * * @param actual the object to compare to other * @param other the object to compare to actual * @return true if actual and other are equal (null safe equals check), false otherwise. */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Returns true if the actual {@code Date} is equal to the given one according to underlying {@link #comparisonStrategy}, false * otherwise. * @param actual the actual date - must not be null. * @param other the given Date. * @return <code>true</code> if the actual {@code Date} is equal to the given one according to underlying * {@link #comparisonStrategy}, false otherwise. */ private boolean areEqual(Date actual, Date other) { return comparisonStrategy.areEqual(actual, other); }
/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
protected <T> boolean areEqual(T actual, T expected) { return comparisonStrategy.areEqual(actual, expected); }
/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Compares actual and other with standard strategy (null safe equals check). * * @param actual the object to compare to other * @param other the object to compare to actual * @return true if actual and other are equal (null safe equals check), false otherwise. */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Returns true if the actual {@code Date} is equal to the given one according to underlying {@link #comparisonStrategy}, false * otherwise. * @param actual the actual date - must not be null. * @param other the given Date. * @return <code>true</code> if the actual {@code Date} is equal to the given one according to underlying * {@link #comparisonStrategy}, false otherwise. */ private boolean areEqual(Date actual, Date other) { return comparisonStrategy.areEqual(actual, other); }
/** * Delegates to {@link ComparisonStrategy#areEqual(Object, Object)} */ private boolean areEqual(Object actual, Object other) { return comparisonStrategy.areEqual(actual, other); }
/** * Count occurrences of sequenceToSearch in actual {@link CharSequence}. * * @param sequenceToSearch the sequence to search in in actual {@link CharSequence}. * @param actual the {@link CharSequence} to search occurrences in. * @return the number of occurrences of sequenceToSearch in actual {@link CharSequence}. */ private int countOccurrences(CharSequence sequenceToSearch, CharSequence actual) { String strToSearch = sequenceToSearch.toString(); String strActual = actual.toString(); int occurrences = 0; for (int i = 0; i <= (strActual.length() - strToSearch.length()); i++) { if (comparisonStrategy.areEqual(strActual.substring(i, i + sequenceToSearch.length()), strToSearch)) { occurrences++; } } return occurrences; }
private void assertEqual(boolean expected) { if (!objects.getComparisonStrategy().areEqual(actual.get(), expected)) { throwAssertionError(shouldHaveValue(actual, expected)); } }
private void assertEqual(boolean expected) { if (!objects.getComparisonStrategy().areEqual(actual.get(), expected)) { throwAssertionError(shouldHaveValue(actual, expected)); } }
public void assertXmlEqualsTo(AssertionInfo info, CharSequence actualXml, CharSequence expectedXml) { // check that actual and expected XML CharSequence are not null. // we consider that null values don't make much sense when you want to compare XML document as String/CharSequence. checkCharSequenceIsNotNull(expectedXml); assertNotNull(info, actualXml); // we only use default comparison strategy, it does not make sense to use a specific comparison strategy final String formattedActualXml = xmlPrettyFormat(actualXml.toString()); final String formattedExpectedXml = xmlPrettyFormat(expectedXml.toString()); if (!comparisonStrategy.areEqual(formattedActualXml, formattedExpectedXml)) throw failures.failure(info, shouldBeEqual(formattedActualXml, formattedExpectedXml, comparisonStrategy, info.representation())); }
public SELF hasValue(VALUE expectedValue, final OBJECT obj) { validate(expectedValue); VALUE actualValue = getActualValue(obj); if (!objects.getComparisonStrategy().areEqual(actualValue, expectedValue)) { throwAssertionError(shouldHaveValue(actual, actualValue, expectedValue, obj)); } return myself; }
public void assertXmlEqualsTo(AssertionInfo info, CharSequence actualXml, CharSequence expectedXml) { // check that actual and expected XML CharSequence are not null. // we consider that null values don't make much sense when you want to compare XML document as String/CharSequence. checkCharSequenceIsNotNull(expectedXml); assertNotNull(info, actualXml); // we only use default comparison strategy, it does not make sense to use a specific comparison strategy final String formattedActualXml = xmlPrettyFormat(actualXml.toString()); final String formattedExpectedXml = xmlPrettyFormat(expectedXml.toString()); if (!comparisonStrategy.areEqual(formattedActualXml, formattedExpectedXml)) throw failures.failure(info, shouldBeEqual(formattedActualXml, formattedExpectedXml, comparisonStrategy, info.representation())); }
public SELF hasReference(VALUE expectedReference) { isNotNull(); if (!this.objects.getComparisonStrategy().areEqual(getReference(), expectedReference)) { throwAssertionError(shouldHaveReference(actual, getReference(), expectedReference)); } return myself; }
public SELF hasValue(VALUE expectedValue, final OBJECT obj) { validate(expectedValue); VALUE actualValue = getActualValue(obj); if (!objects.getComparisonStrategy().areEqual(actualValue, expectedValue)) { throwAssertionError(shouldHaveValue(actual, actualValue, expectedValue, obj)); } return myself; }
public SELF hasReference(VALUE expectedReference) { isNotNull(); if (!this.objects.getComparisonStrategy().areEqual(getReference(), expectedReference)) { throwAssertionError(shouldHaveReference(actual, getReference(), expectedReference)); } return myself; }