Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @pivovarit @mchmielarz
* @mchmielarz
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '15', '16', '17' ]
java: [ '11', '17', '19', '20' ]
architecture: [ 'x64' ]
name: Build with JDK ${{ matrix.java }} on ${{ matrix.architecture }}
steps:
Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@
</executions>
</plugin>

<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<properties>
<!-- Values to be substituted in template -->
<currentYear>2023</currentYear>
</properties>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/assertj/vavr/api/AbstractLazyAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/assertj/vavr/api/AbstractMapAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
7 changes: 2 additions & 5 deletions src/main/java/org/assertj/vavr/api/AbstractSeqAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand All @@ -19,15 +19,13 @@
import org.assertj.core.data.Index;
import org.assertj.core.internal.ComparatorBasedComparisonStrategy;
import org.assertj.core.internal.ComparisonStrategy;
import org.assertj.core.internal.Iterables;
import org.assertj.core.internal.StandardComparisonStrategy;
import org.assertj.core.util.CheckReturnValue;

import java.util.Comparator;
import java.util.function.Consumer;

import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ShouldBeSorted.shouldHaveComparableElementsAccordingToGivenComparator;
import static org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex;
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
Expand Down Expand Up @@ -68,7 +66,6 @@ abstract class AbstractSeqAssert<SELF extends AbstractSeqAssert<SELF, ACTUAL, EL
*/
@CheckReturnValue
public SELF usingElementComparator(Comparator<? super ELEMENT> customComparator) {
this.iterables = new Iterables(new ComparatorBasedComparisonStrategy(customComparator));
seqElementComparisonStrategy = new ComparatorBasedComparisonStrategy(customComparator);
return myself;
}
Expand Down Expand Up @@ -328,7 +325,7 @@ private void assertIsSortedAccordingToComparator(Comparator<?> comparator) {

private void assertConditionIsMetAtIndex(Condition<? super ELEMENT> condition, Index index, Runnable errorProvider) {
isNotNull();
requireNonNull(condition, "The condition to evaluate should not be null");
checkNotNull(condition, "The condition to evaluate should not be null");

assertNotEmpty();
assertIndexIsValid(index);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/assertj/vavr/api/AbstractSetAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

import io.vavr.collection.Set;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.EnumerableAssert;

import java.util.Comparator;

abstract class AbstractSetAssert<SELF extends AbstractSetAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>,
ACTUAL extends Set<? extends ELEMENT>,
ELEMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
44 changes: 23 additions & 21 deletions src/main/java/org/assertj/vavr/api/AbstractTryAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*/
package org.assertj.vavr.api;

import io.vavr.control.Try;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.Condition;
import org.assertj.core.internal.*;
import org.assertj.core.util.CheckReturnValue;
Expand All @@ -40,7 +39,7 @@
abstract class AbstractTryAssert<SELF extends AbstractTryAssert<SELF, VALUE>, VALUE> extends
AbstractValueAssert<SELF, Try<VALUE>> {

private Conditions conditions = Conditions.instance();
private final Conditions conditions = Conditions.instance();

private ComparisonStrategy tryValueComparisonStrategy;

Expand Down Expand Up @@ -90,6 +89,9 @@ public SELF contains(VALUE expectedValue) {
*
* @param requirement to further assert on the object contained inside the {@link io.vavr.control.Try}.
* @return this assertion object.
* @throws AssertionError if the actual {@link io.vavr.control.Try} is null or empty.
* @throws NullPointerException if the given condition is {@code null}.
* @throws AssertionError if the actual value does not satisfy the given condition.
*/
public SELF hasValueSatisfying(Consumer<VALUE> requirement) {
assertIsSuccess();
Expand All @@ -98,11 +100,11 @@ public SELF hasValueSatisfying(Consumer<VALUE> requirement) {
}

/**
* Verifies that the actual {@link Try} contains a value which satisfies the given {@link Condition}.
* Verifies that the actual {@link io.vavr.control.Try} contains a value which satisfies the given {@link org.assertj.core.api.Condition}.
*
* @param condition the given condition.
* @return this assertion object.
* @throws AssertionError if the actual {@link Try} is null or empty.
* @throws AssertionError if the actual {@link io.vavr.control.Try} is null or empty.
* @throws NullPointerException if the given condition is {@code null}.
* @throws AssertionError if the actual value does not satisfy the given condition.
*/
Expand All @@ -113,9 +115,9 @@ public SELF hasValueSatisfying(Condition<? super VALUE> condition) {
}

/**
* Verifies that the actual {@link Try} contains a value that is an instance of the argument.
* Verifies that the actual {@link io.vavr.control.Try} contains a value that is an instance of the argument.
*
* @param clazz the expected class of the value inside the {@link Try}.
* @param clazz the expected class of the value inside the {@link io.vavr.control.Try}.
* @return this assertion object.
*/
public SELF containsInstanceOf(Class<?> clazz) {
Expand All @@ -126,9 +128,9 @@ public SELF containsInstanceOf(Class<?> clazz) {

/**
* Use field/property by field/property comparison (including inherited fields/properties) instead of relying on
* actual type A <code>equals</code> method to compare the {@link Try} value's object for incoming assertion
* actual type A <code>equals</code> method to compare the {@link io.vavr.control.Try} value's object for incoming assertion
* checks. Private fields are included but this can be disabled using
* {@link Assertions#setAllowExtractingPrivateFields(boolean)}.
* {@link org.assertj.core.api.Assertions#setAllowExtractingPrivateFields(boolean)}.
*
* @return {@code this} assertion object.
*/
Expand All @@ -139,7 +141,7 @@ public SELF usingFieldByFieldValueComparator() {

/**
* Use given custom comparator instead of relying on actual type A <code>equals</code> method to compare the
* {@link Try} value's object for incoming assertion checks.
* {@link io.vavr.control.Try} value's object for incoming assertion checks.
*
* @param customComparator the comparator to use for incoming assertion checks.
* @return {@code this} assertion object.
Expand All @@ -152,7 +154,7 @@ public SELF usingValueComparator(Comparator<? super VALUE> customComparator) {
}

/**
* Revert to standard comparison for incoming assertion {@link Try} value checks.
* Revert to standard comparison for incoming assertion {@link io.vavr.control.Try} value checks.
* <p>
* This method should be used to disable a custom comparison strategy set by calling
* {@link #usingValueComparator(Comparator)}.
Expand Down Expand Up @@ -180,13 +182,13 @@ public SELF containsSame(VALUE expectedValue) {
}

/**
* Call {@link Try#flatMap(Function) flatMap} on the {@code Try} under test, assertions chained afterwards are performed on the {@code Try} resulting from the flatMap call.
* Call {@link io.vavr.control.Try#flatMap(Function) flatMap} on the {@code Try} under test, assertions chained afterward are performed on the {@code Try} resulting from the flatMap call.
*
* @param <U> type of a value contained by successful {@link Try} created by {@code mapper} function
* @param mapper the {@link Function} to use in the {@link Try#flatMap(Function) flatMap} operation.
* @param <U> type of value contained by successful {@link io.vavr.control.Try} created by {@code mapper} function
* @param mapper the {@link java.util.function.Function} to use in the {@link io.vavr.control.Try#flatMap(Function) flatMap} operation.
*
* @return a new {@link org.assertj.vavr.api.AbstractTryAssert} for assertions chaining on the flatMap of the Try.
* @throws AssertionError if the actual {@link Try} is null.
* @throws AssertionError if the actual {@link io.vavr.control.Try} is null.
*/
@CheckReturnValue
public <U> AbstractTryAssert<?, U> flatMap(Function<? super VALUE, Try<U>> mapper) {
Expand All @@ -195,13 +197,13 @@ public <U> AbstractTryAssert<?, U> flatMap(Function<? super VALUE, Try<U>> mappe
}

/**
* Call {@link Try#map(Function) map} on the {@code Try} under test, assertions chained afterwards are performed on the {@code Try} resulting from the map call.
* Call {@link io.vavr.control.Try#map(Function) map} on the {@code Try} under test, assertions chained afterward are performed on the {@code Try} resulting from the map call.
*
* @param <U> type of a value created by {@code mapper} function
* @param mapper the {@link Function} to use in the {@link Try#map(Function) map} operation.
* @param <U> type of value created by {@code mapper} function
* @param mapper the {@link java.util.function.Function} to use in the {@link io.vavr.control.Try#map(Function) map} operation.
*
* @return a new {@link org.assertj.vavr.api.AbstractTryAssert} for assertions chaining on the map of the Try.
* @throws AssertionError if the actual {@link Try} is null.
* @throws AssertionError if the actual {@link io.vavr.control.Try} is null.
*/
@CheckReturnValue
public <U> AbstractTryAssert<?, U> map(Function<? super VALUE, ? extends U> mapper) {
Expand All @@ -210,9 +212,9 @@ public <U> AbstractTryAssert<?, U> map(Function<? super VALUE, ? extends U> mapp
}

/**
* Verifies that the actual {@link Try} fails because of specific {@link Throwable}.
* Verifies that the actual {@link io.vavr.control.Try} fails because of specific {@link java.lang.Throwable}.
*
* @param <U> specific type of {@link Throwable}
* @param <U> specific type of {@link java.lang.Throwable}
* @param reason the expected exception class.
*
* @return this assertion object.
Expand Down
Loading