Skip to content

Commit

Permalink
Fix typo in error message factories (#1506) (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
scordio authored and joel-costigliola committed May 22, 2019
1 parent ce439bd commit 85f180c
Show file tree
Hide file tree
Showing 30 changed files with 167 additions and 257 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/assertj/core/api/AbstractDateAssert.java
Expand Up @@ -711,7 +711,7 @@ public SELF isBeforeOrEqualsTo(Date other) {
}

/**
* Verifies that the actual {@code Date} is before or equals to the given one.
* Verifies that the actual {@code Date} is before or equal to the given one.
* <p>
* Example:
* <pre><code class='java'> SimpleDateFormat dateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);
Expand Down Expand Up @@ -914,7 +914,7 @@ public SELF isAfterOrEqualsTo(Date other) {
}

/**
* Verifies that the actual {@code Date} is after or equals to the given one.
* Verifies that the actual {@code Date} is after or equal to the given one.
* <p>
* Example:
* <pre><code class='java'> SimpleDateFormat dateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/assertj/core/api/AbstractInstantAssert.java
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.util.Preconditions.checkArgument;

import java.time.Instant;
Expand Down Expand Up @@ -108,7 +108,7 @@ public SELF isBeforeOrEqualTo(Instant other) {
assertNotNull(info, actual);
assertInstantParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public SELF isAfterOrEqualTo(Instant other) {
assertNotNull(info, actual);
assertInstantParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeToday.shouldBeToday;
import static org.assertj.core.util.Preconditions.checkArgument;

Expand Down Expand Up @@ -104,7 +104,7 @@ public SELF isBeforeOrEqualTo(LocalDate other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ public SELF isAfterOrEqualTo(LocalDate other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeEqualIgnoringHours.shouldBeEqualIgnoringHours;
import static org.assertj.core.error.ShouldBeEqualIgnoringMinutes.shouldBeEqualIgnoringMinutes;
import static org.assertj.core.error.ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos;
Expand Down Expand Up @@ -113,7 +113,7 @@ public SELF isBeforeOrEqualTo(LocalDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ public SELF isAfterOrEqualTo(LocalDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos;
import static org.assertj.core.error.ShouldBeEqualIgnoringSeconds.shouldBeEqualIgnoringSeconds;
import static org.assertj.core.error.ShouldHaveSameHourAs.shouldHaveSameHourAs;
Expand Down Expand Up @@ -106,7 +106,7 @@ public SELF isBeforeOrEqualTo(LocalTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ public SELF isAfterOrEqualTo(LocalTime other) {
Objects.instance().assertNotNull(info, actual);
assertLocalTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeEqualIgnoringHours.shouldBeEqualIgnoringHours;
import static org.assertj.core.error.ShouldBeEqualIgnoringMinutes.shouldBeEqualIgnoringMinutes;
import static org.assertj.core.error.ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos;
Expand Down Expand Up @@ -116,7 +116,7 @@ public SELF isBeforeOrEqualTo(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ public SELF isAfterOrEqualTo(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos;
import static org.assertj.core.error.ShouldBeEqualIgnoringSeconds.shouldBeEqualIgnoringSeconds;
import static org.assertj.core.error.ShouldBeEqualIgnoringTimezone.shouldBeEqualIgnoringTimezone;
Expand Down Expand Up @@ -110,7 +110,7 @@ public SELF isBeforeOrEqualTo(OffsetTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public SELF isAfterOrEqualTo(OffsetTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -13,9 +13,9 @@
package org.assertj.core.api;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeEqualIgnoringHours.shouldBeEqualIgnoringHours;
import static org.assertj.core.error.ShouldBeEqualIgnoringMinutes.shouldBeEqualIgnoringMinutes;
import static org.assertj.core.error.ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos;
Expand Down Expand Up @@ -112,7 +112,7 @@ public SELF isBeforeOrEqualTo(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (actual.isAfter(other)) {
throw Failures.instance().failure(info, shouldBeBeforeOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeBeforeOrEqualTo(actual, other));
}
return myself;
}
Expand Down Expand Up @@ -162,7 +162,7 @@ public SELF isAfterOrEqualTo(ZonedDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
throw Failures.instance().failure(info, shouldBeAfterOrEqualTo(actual, other));
}
return myself;
}
Expand Down
Expand Up @@ -15,37 +15,38 @@
import org.assertj.core.internal.ComparisonStrategy;
import org.assertj.core.internal.StandardComparisonStrategy;


/**
* Creates an error message indicating that an assertion that verifies that a {@link Object} is before or equals to another one
* Creates an error message indicating that an assertion that verifies that an {@link Object} is after or equal to another one
* failed.
*
* @author Joel Costigliola
*/
public class ShouldBeBeforeOrEqualsTo extends BasicErrorMessageFactory {
public class ShouldBeAfterOrEqualTo extends BasicErrorMessageFactory {

/**
* Creates a new <code>{@link ShouldBeBeforeOrEqualsTo}</code>.
* Creates a new <code>{@link ShouldBeAfterOrEqualTo}</code>.
*
* @param actual the actual value in the failed assertion.
* @param other the value used in the failed assertion to compare the actual value to.
* @param comparisonStrategy the {@link ComparisonStrategy} used to evaluate assertion.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldBeBeforeOrEqualsTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
return new ShouldBeBeforeOrEqualsTo(actual, other, comparisonStrategy);
public static ErrorMessageFactory shouldBeAfterOrEqualTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
return new ShouldBeAfterOrEqualTo(actual, other, comparisonStrategy);
}

/**
* Creates a new <code>{@link ShouldBeBeforeOrEqualsTo}</code>.
* Creates a new <code>{@link ShouldBeAfterOrEqualTo}</code>.
*
* @param actual the actual value in the failed assertion.
* @param other the value used in the failed assertion to compare the actual value to.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldBeBeforeOrEqualsTo(Object actual, Object other) {
return new ShouldBeBeforeOrEqualsTo(actual, other, StandardComparisonStrategy.instance());
public static ErrorMessageFactory shouldBeAfterOrEqualTo(Object actual, Object other) {
return new ShouldBeAfterOrEqualTo(actual, other, StandardComparisonStrategy.instance());
}

private ShouldBeBeforeOrEqualsTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
super("%nExpecting:%n <%s>%nto be before or equals to:%n <%s>%s", actual, other, comparisonStrategy);
private ShouldBeAfterOrEqualTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
super("%nExpecting:%n <%s>%nto be after or equal to:%n <%s>%s", actual, other, comparisonStrategy);
}
}
Expand Up @@ -12,44 +12,41 @@
*/
package org.assertj.core.error;

import java.util.Date;

import org.assertj.core.internal.*;
import org.assertj.core.internal.ComparisonStrategy;
import org.assertj.core.internal.StandardComparisonStrategy;

/**
* Creates an error message indicating that an assertion that verifies that a {@link Date} is after or equals to another
* one
* Creates an error message indicating that an assertion that verifies that an {@link Object} is before or equal to another one
* failed.
*
* @author Joel Costigliola
*/
public class ShouldBeAfterOrEqualsTo extends BasicErrorMessageFactory {
public class ShouldBeBeforeOrEqualTo extends BasicErrorMessageFactory {

/**
* Creates a new <code>{@link ShouldBeAfterOrEqualsTo}</code>.
* Creates a new <code>{@link ShouldBeBeforeOrEqualTo}</code>.
*
* @param actual the actual value in the failed assertion.
* @param other the value used in the failed assertion to compare the actual value to.
* @param comparisonStrategy the {@link ComparisonStrategy} used to evaluate assertion.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldBeAfterOrEqualsTo(Object actual, Object other,
ComparisonStrategy comparisonStrategy) {
return new ShouldBeAfterOrEqualsTo(actual, other, comparisonStrategy);
public static ErrorMessageFactory shouldBeBeforeOrEqualTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
return new ShouldBeBeforeOrEqualTo(actual, other, comparisonStrategy);
}

/**
* Creates a new <code>{@link ShouldBeAfterOrEqualsTo}</code>.
* Creates a new <code>{@link ShouldBeBeforeOrEqualTo}</code>.
*
* @param actual the actual value in the failed assertion.
* @param other the value used in the failed assertion to compare the actual value to.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldBeAfterOrEqualsTo(Object actual, Object other) {
return new ShouldBeAfterOrEqualsTo(actual, other, StandardComparisonStrategy.instance());
public static ErrorMessageFactory shouldBeBeforeOrEqualTo(Object actual, Object other) {
return new ShouldBeBeforeOrEqualTo(actual, other, StandardComparisonStrategy.instance());
}

private ShouldBeAfterOrEqualsTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
super("%nExpecting:%n <%s>%nto be after or equals to:%n <%s>%s", actual, other, comparisonStrategy);
private ShouldBeBeforeOrEqualTo(Object actual, Object other, ComparisonStrategy comparisonStrategy) {
super("%nExpecting:%n <%s>%nto be before or equal to:%n <%s>%s", actual, other, comparisonStrategy);
}
}
8 changes: 4 additions & 4 deletions src/main/java/org/assertj/core/internal/Dates.java
Expand Up @@ -13,10 +13,10 @@
package org.assertj.core.internal;

import static org.assertj.core.error.ShouldBeAfter.shouldBeAfter;
import static org.assertj.core.error.ShouldBeAfterOrEqualsTo.shouldBeAfterOrEqualsTo;
import static org.assertj.core.error.ShouldBeAfterOrEqualTo.shouldBeAfterOrEqualTo;
import static org.assertj.core.error.ShouldBeAfterYear.shouldBeAfterYear;
import static org.assertj.core.error.ShouldBeBefore.shouldBeBefore;
import static org.assertj.core.error.ShouldBeBeforeOrEqualsTo.shouldBeBeforeOrEqualsTo;
import static org.assertj.core.error.ShouldBeBeforeOrEqualTo.shouldBeBeforeOrEqualTo;
import static org.assertj.core.error.ShouldBeBeforeYear.shouldBeBeforeYear;
import static org.assertj.core.error.ShouldBeBetween.shouldBeBetween;
import static org.assertj.core.error.ShouldBeCloseTo.shouldBeCloseTo;
Expand Down Expand Up @@ -128,7 +128,7 @@ public void assertIsBeforeOrEqualTo(AssertionInfo info, Date actual, Date other)
assertNotNull(info, actual);
dateParameterIsNotNull(other);
if (!isBeforeOrEqualTo(actual, other))
throw failures.failure(info, shouldBeBeforeOrEqualsTo(actual, other, comparisonStrategy));
throw failures.failure(info, shouldBeBeforeOrEqualTo(actual, other, comparisonStrategy));
}

/**
Expand Down Expand Up @@ -160,7 +160,7 @@ public void assertIsAfterOrEqualTo(AssertionInfo info, Date actual, Date other)
assertNotNull(info, actual);
dateParameterIsNotNull(other);
if (!isAfterOrEqualTo(actual, other))
throw failures.failure(info, shouldBeAfterOrEqualsTo(actual, other, comparisonStrategy));
throw failures.failure(info, shouldBeAfterOrEqualTo(actual, other, comparisonStrategy));
}

/**
Expand Down
Expand Up @@ -18,7 +18,6 @@

import org.assertj.core.api.DateAssert;


/**
* Tests for <code>{@link DateAssert#isAfterOrEqualTo(Date)}</code>.
*
Expand Down

0 comments on commit 85f180c

Please sign in to comment.