Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
This is a preliminary step before the introduction of Spotless.
Relates to #2530 and #2533.
  • Loading branch information
scordio committed Jul 20, 2023
1 parent d5a0d54 commit 38c7b4b
Show file tree
Hide file tree
Showing 1,295 changed files with 4,171 additions and 3,660 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ public SELF isEqualToNormalizingUnicode(CharSequence expected) {
* @throws AssertionError if the actual {@code CharSequence} is not alphabetic.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isAlphabetic(){
public SELF isAlphabetic() {
isNotNull();
if (!Pattern.matches("\\p{Alpha}+", actual)) throwAssertionError(shouldBeAlphabetic(actual));
return myself;
Expand All @@ -1982,7 +1982,7 @@ public SELF isAlphabetic(){
* @throws AssertionError if the actual {@code CharSequence} is not alphanumeric.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isAlphanumeric(){
public SELF isAlphanumeric() {
isNotNull();
if (!Pattern.matches("\\p{Alnum}+", actual)) throwAssertionError(shouldBeAlphanumeric(actual));
return myself;
Expand All @@ -2008,7 +2008,7 @@ public SELF isAlphanumeric(){
* @throws AssertionError if the actual {@code CharSequence} is not ASCII.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isASCII(){
public SELF isASCII() {
isNotNull();
if (!Pattern.matches("\\p{ASCII}+", actual)) throwAssertionError(shouldBeASCII(actual));
return myself;
Expand All @@ -2034,7 +2034,7 @@ public SELF isASCII(){
* @throws AssertionError if the actual {@code CharSequence} is not hexadecimal.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isHexadecimal(){
public SELF isHexadecimal() {
isNotNull();
if (!Pattern.matches("\\p{XDigit}+", actual)) throwAssertionError(shouldBeHexadecimal(actual));
return myself;
Expand All @@ -2061,7 +2061,7 @@ public SELF isHexadecimal(){
* @throws AssertionError if the actual {@code CharSequence} is not printable.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isPrintable(){
public SELF isPrintable() {
isNotNull();
if (!Pattern.matches("\\p{Print}+", actual)) throwAssertionError(shouldBePrintable(actual));
return myself;
Expand All @@ -2087,7 +2087,7 @@ public SELF isPrintable(){
* @throws AssertionError if the actual {@code CharSequence} is not visible.
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>
*/
public SELF isVisible(){
public SELF isVisible() {
isNotNull();
if (!Pattern.matches("\\p{Graph}+", actual)) throwAssertionError(shouldBeVisible(actual));
return myself;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public SELF isUnmodifiable() {
@SuppressWarnings("unchecked")
private void assertIsUnmodifiable() {
switch (actual.getClass().getName()) {
case "java.util.Collections$EmptyList":
case "java.util.Collections$EmptyNavigableSet":
case "java.util.Collections$EmptySet":
case "java.util.Collections$EmptySortedSet":
case "java.util.Collections$SingletonList":
case "java.util.Collections$SingletonSet":
// immutable by contract, although not all methods throw UnsupportedOperationException
return;
case "java.util.Collections$EmptyList":
case "java.util.Collections$EmptyNavigableSet":
case "java.util.Collections$EmptySet":
case "java.util.Collections$EmptySortedSet":
case "java.util.Collections$SingletonList":
case "java.util.Collections$SingletonSet":
// immutable by contract, although not all methods throw UnsupportedOperationException
return;
}

expectUnsupportedOperationException(() -> actual.add(null), "Collection.add(null)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ private ObjectAssert<RESULT> internalSucceedsWithin(Duration timeout) {
protected ObjectAssert<RESULT> newObjectAssert(RESULT objectUnderTest) {
return new ObjectAssert<>(objectUnderTest);
}

/**
* Waits if necessary for at most the given time for this future to complete, and then returns its result for further assertions.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ public SELF hasParent(String expected) {
* @return {@code this} assertion object.
* @throws NullPointerException if the expected extension is {@code null}.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not a file (ie a directory).
* @throws AssertionError if the actual {@code File} is not a file (i.e., a directory).
* @throws AssertionError if the actual {@code File} does not have the expected extension.
*
* @see <a href="http://en.wikipedia.org/wiki/Filename_extension">Filename extension</a>
Expand Down Expand Up @@ -1433,7 +1433,7 @@ public AbstractStringAssert<?> content(Charset charset) {
*
* @return {@code this} assertion object.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not a file (ie a directory or does not exist).
* @throws AssertionError if the actual {@code File} is not a file (i.e., a directory or does not exist).
* @throws AssertionError if the actual {@code File} does have an extension.
*/
public SELF hasNoExtension() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,11 @@ public SELF isStrictlyBetween(String startExclusive, String endExclusive) {
public SELF hasHour(int hour) {
Objects.instance().assertNotNull(info, actual);
if (actual.getHour() != hour) {
throw Failures.instance().failure(info, shouldHaveDateField(actual,"hour", hour));
throw Failures.instance().failure(info, shouldHaveDateField(actual, "hour", hour));
}
return myself;
}


/**
* Verifies that actual {@code LocalTime} is in the given minute.
* <p>
Expand All @@ -631,7 +630,7 @@ public SELF hasHour(int hour) {
public SELF hasMinute(int minute) {
Objects.instance().assertNotNull(info, actual);
if (actual.getMinute() != minute) {
throw Failures.instance().failure(info, shouldHaveDateField(actual,"minute", minute));
throw Failures.instance().failure(info, shouldHaveDateField(actual, "minute", minute));
}
return myself;
}
Expand All @@ -656,7 +655,7 @@ public SELF hasMinute(int minute) {
public SELF hasSecond(int second) {
Objects.instance().assertNotNull(info, actual);
if (actual.getSecond() != second) {
throw Failures.instance().failure(info, shouldHaveDateField(actual,"second", second));
throw Failures.instance().failure(info, shouldHaveDateField(actual, "second", second));
}
return myself;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1428,18 +1428,19 @@ public SELF isUnmodifiable() {
@SuppressWarnings("unchecked")
private void assertIsUnmodifiable() {
switch (actual.getClass().getName()) {
case "java.util.Collections$EmptyNavigableMap":
case "java.util.Collections$EmptyMap":
case "java.util.Collections$EmptySortedMap":
case "java.util.Collections$SingletonMap":
// unmodifiable by contract, although not all methods throw UnsupportedOperationException
return;
case "java.util.Collections$EmptyNavigableMap":
case "java.util.Collections$EmptyMap":
case "java.util.Collections$EmptySortedMap":
case "java.util.Collections$SingletonMap":
// unmodifiable by contract, although not all methods throw UnsupportedOperationException
return;
}

expectUnsupportedOperationException(() -> actual.clear(), "Map.clear()");
expectUnsupportedOperationException(() -> actual.compute(null, (k, v) -> v), "Map.compute(null, (k, v) -> v)");
expectUnsupportedOperationException(() -> actual.computeIfAbsent(null, k -> null), "Map.computeIfAbsent(null, k -> null)");
expectUnsupportedOperationException(() -> actual.computeIfPresent(null, (k, v) -> v), "Map.computeIfPresent(null, (k, v) -> v)");
expectUnsupportedOperationException(() -> actual.computeIfPresent(null, (k, v) -> v),
"Map.computeIfPresent(null, (k, v) -> v)");
expectUnsupportedOperationException(() -> actual.merge(null, null, (v1, v2) -> v1), "Map.merge(null, null, (v1, v2) -> v1))");
expectUnsupportedOperationException(() -> actual.put(null, null), "Map.put(null, null)");
expectUnsupportedOperationException(() -> actual.putAll(new HashMap<>()), "Map.putAll(new HashMap<>())");
Expand All @@ -1451,7 +1452,7 @@ private void assertIsUnmodifiable() {
expectUnsupportedOperationException(() -> actual.replaceAll((k, v) -> v), "Map.replaceAll((k, v) -> v)");

if (actual instanceof NavigableMap) {
NavigableMap<K, V> navigableMap = (NavigableMap<K, V> ) actual;
NavigableMap<K, V> navigableMap = (NavigableMap<K, V>) actual;
expectUnsupportedOperationException(() -> navigableMap.pollFirstEntry(), "NavigableMap.pollFirstEntry()");
expectUnsupportedOperationException(() -> navigableMap.pollLastEntry(), "NavigableMap.pollLastEntry()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@

import org.assertj.core.internal.Failures;


/**
* Assertions for {@link java.util.regex.Matcher}
*
* @author Jiashu Zhang
*/
public abstract class AbstractMatcherAssert<SELF extends AbstractMatcherAssert<SELF>> extends
AbstractAssert<SELF, Matcher> {
public abstract class AbstractMatcherAssert<SELF extends AbstractMatcherAssert<SELF>> extends AbstractAssert<SELF, Matcher> {

protected AbstractMatcherAssert(Matcher actual, Class<?> selfType) {
super(actual, selfType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4104,7 +4104,7 @@ public RecursiveAssertionAssert usingRecursiveAssertion() {
public RecursiveAssertionAssert usingRecursiveAssertion(RecursiveAssertionConfiguration recursiveAssertionConfiguration) {
return super.usingRecursiveAssertion(recursiveAssertionConfiguration);
}

/**
* Verifies that the array under test contains a single element and allows to perform assertions on that element.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* @author Grzegorz Piwowarek
*/
// Deprecation is raised by JDK-17. IntelliJ thinks this is redundant when it is not.
@SuppressWarnings({"deprecation", "RedundantSuppression"})
@SuppressWarnings({ "deprecation", "RedundantSuppression" })
public abstract class AbstractOptionalAssert<SELF extends AbstractOptionalAssert<SELF, VALUE>, VALUE> extends
AbstractAssert<SELF, Optional<VALUE>> {

Expand Down Expand Up @@ -280,7 +280,7 @@ public SELF containsInstanceOf(Class<?> clazz) {
*/
@Deprecated
@CheckReturnValue
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"})
@SuppressWarnings({ "DeprecatedIsStillUsed", "deprecation" })
public SELF usingFieldByFieldValueComparator() {
return usingValueComparator(new FieldByFieldComparator());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* @author Alexander Bischof
* @author Grzegorz Piwowarek
*/
public abstract class AbstractOptionalDoubleAssert<SELF extends AbstractOptionalDoubleAssert<SELF>> extends
AbstractAssert<SELF, OptionalDouble> {
public abstract class AbstractOptionalDoubleAssert<SELF extends AbstractOptionalDoubleAssert<SELF>>
extends AbstractAssert<SELF, OptionalDouble> {

@VisibleForTesting
Doubles doubles = Doubles.instance();
Expand Down Expand Up @@ -77,7 +77,7 @@ public SELF isPresent() {
public SELF isNotPresent() {
return isEmpty();
}

/**
* Verifies that the actual {@link java.util.OptionalDouble} is empty.
* <p>
Expand Down Expand Up @@ -203,7 +203,8 @@ public SELF hasValueCloseTo(Double expectedValue, Percentage percentage) {
try {
doubles.assertIsCloseToPercentage(info, actual.getAsDouble(), expectedValue, percentage);
} catch (AssertionError assertionError) {
throwAssertionError(shouldHaveValueCloseToPercentage(actual, expectedValue, percentage, abs(expectedValue - actual.getAsDouble())));
throwAssertionError(shouldHaveValueCloseToPercentage(actual, expectedValue, percentage,
abs(expectedValue - actual.getAsDouble())));
}
return myself;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public SELF isPresent() {
public SELF isNotPresent() {
return isEmpty();
}

/**
* Verifies that the actual {@link java.util.OptionalInt} is empty.
* <p>
Expand Down
12 changes: 6 additions & 6 deletions assertj-core/src/main/java/org/assertj/core/api/Assertions.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public static <T> PredicateAssert<T> assertThat(Predicate<T> actual) {
return AssertionsForInterfaceTypes.assertThat(actual);
}


/**
* Create assertion for {@link Predicate}.
* <p>
Expand Down Expand Up @@ -1611,7 +1610,8 @@ public static IOException catchIOException(ThrowingCallable shouldRaiseIOExcepti
* @since 3.22.0
*/
public static ReflectiveOperationException catchReflectiveOperationException(ThrowingCallable shouldRaiseReflectiveOperationException) {
return AssertionsForClassTypes.catchThrowableOfType(shouldRaiseReflectiveOperationException, ReflectiveOperationException.class);
return AssertionsForClassTypes.catchThrowableOfType(shouldRaiseReflectiveOperationException,
ReflectiveOperationException.class);
}

/**
Expand Down Expand Up @@ -1753,7 +1753,7 @@ public static ThrowableTypeAssert<IllegalStateException> assertThatIllegalStateE
*
* @since 3.23.0
*/
public static ThrowableTypeAssert<Exception> assertThatException(){
public static ThrowableTypeAssert<Exception> assertThatException() {
return assertThatExceptionOfType(Exception.class);
}

Expand All @@ -1764,7 +1764,7 @@ public static ThrowableTypeAssert<Exception> assertThatException(){
*
* @since 3.23.0
*/
public static ThrowableTypeAssert<RuntimeException> assertThatRuntimeException(){
public static ThrowableTypeAssert<RuntimeException> assertThatRuntimeException() {
return assertThatExceptionOfType(RuntimeException.class);
}

Expand All @@ -1775,7 +1775,7 @@ public static ThrowableTypeAssert<RuntimeException> assertThatRuntimeException()
*
* @since 3.23.0
*/
public static ThrowableTypeAssert<ReflectiveOperationException> assertThatReflectiveOperationException(){
public static ThrowableTypeAssert<ReflectiveOperationException> assertThatReflectiveOperationException() {
return assertThatExceptionOfType(ReflectiveOperationException.class);
}

Expand All @@ -1786,7 +1786,7 @@ public static ThrowableTypeAssert<ReflectiveOperationException> assertThatReflec
*
* @since 3.23.0
*/
public static ThrowableTypeAssert<IndexOutOfBoundsException> assertThatIndexOutOfBoundsException(){
public static ThrowableTypeAssert<IndexOutOfBoundsException> assertThatIndexOutOfBoundsException() {
return assertThatExceptionOfType(IndexOutOfBoundsException.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static RuntimeException assumptionNotMet(AssertionError assertionError) throws R
Class<?> assumptionExceptionClass = preferredAssumptionException.getAssumptionExceptionClass();
return buildAssumptionException(assumptionExceptionClass, assertionError);
}

@VisibleForTesting
public static PreferredAssumptionException getPreferredAssumptionException() {
return preferredAssumptionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public AtomicBooleanAssert usingComparator(Comparator<? super AtomicBoolean> cus
*/
@Override
@Deprecated
public AtomicBooleanAssert usingComparator(Comparator<? super AtomicBoolean> customComparator, String customComparatorDescription) {
public AtomicBooleanAssert usingComparator(Comparator<? super AtomicBoolean> customComparator,
String customComparatorDescription) {
throw new UnsupportedOperationException("custom Comparator is not supported for AtomicBoolean comparison");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ public AtomicIntegerAssert usingComparator(Comparator<? super AtomicInteger> cus

@Override
@CheckReturnValue
public AtomicIntegerAssert usingComparator(Comparator<? super AtomicInteger> customComparator, String customComparatorDescription) {
public AtomicIntegerAssert usingComparator(Comparator<? super AtomicInteger> customComparator,
String customComparatorDescription) {
integers = new Integers(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription));
return super.usingComparator(customComparator, customComparatorDescription);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.assertj.core.api;


import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

/**
Expand All @@ -25,12 +24,13 @@
* @author epeee
* @since 2.7.0 / 3.7.0
*/
public class AtomicIntegerFieldUpdaterAssert<OBJECT> extends AbstractAtomicFieldUpdaterAssert<AtomicIntegerFieldUpdaterAssert<OBJECT>, Integer, AtomicIntegerFieldUpdater<OBJECT>, OBJECT> {
public class AtomicIntegerFieldUpdaterAssert<OBJECT> extends
AbstractAtomicFieldUpdaterAssert<AtomicIntegerFieldUpdaterAssert<OBJECT>, Integer, AtomicIntegerFieldUpdater<OBJECT>, OBJECT> {

public AtomicIntegerFieldUpdaterAssert(AtomicIntegerFieldUpdater<OBJECT> actual) {
super(actual, AtomicIntegerFieldUpdaterAssert.class, false);
}

/**
* Verifies that the actual atomic field updater contains the given value at the given object.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.assertj.core.api;


import java.util.concurrent.atomic.AtomicLongFieldUpdater;

/**
Expand All @@ -25,7 +24,8 @@
* @author epeee
* @since 2.7.0 / 3.7.0
*/
public class AtomicLongFieldUpdaterAssert<OBJECT> extends AbstractAtomicFieldUpdaterAssert<AtomicLongFieldUpdaterAssert<OBJECT>, Long, AtomicLongFieldUpdater<OBJECT>, OBJECT> {
public class AtomicLongFieldUpdaterAssert<OBJECT>
extends AbstractAtomicFieldUpdaterAssert<AtomicLongFieldUpdaterAssert<OBJECT>, Long, AtomicLongFieldUpdater<OBJECT>, OBJECT> {

public AtomicLongFieldUpdaterAssert(AtomicLongFieldUpdater<OBJECT> actual) {
super(actual, AtomicLongFieldUpdaterAssert.class, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public AtomicMarkableReferenceAssert(AtomicMarkableReference<VALUE> actual) {
public AtomicMarkableReferenceAssert<VALUE> hasReference(VALUE expectedValue) {
return super.hasReference(expectedValue);
}

@Override
protected VALUE getReference() {
return actual.getReference();
Expand Down

0 comments on commit 38c7b4b

Please sign in to comment.