Skip to content

Start of Multimap Assertions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5e9d61e
Initial scaffold of AbstractMultimapAssert
mattbertolini Feb 8, 2025
a65be44
Add the containsKeys assertion
mattbertolini Feb 8, 2025
b8c94ed
Add the contains assertion
mattbertolini Feb 8, 2025
85d661a
Docs
mattbertolini Feb 8, 2025
27cfe5c
Add isNullOrEmpty contract
mattbertolini Feb 8, 2025
4f81348
Add isNotEmpty contract
mattbertolini Feb 8, 2025
edc1521
Fix abstract class
mattbertolini Feb 8, 2025
5571114
Add isEmpty assertion
mattbertolini Feb 8, 2025
15a073e
Fix imports
mattbertolini Feb 8, 2025
af1950e
Add hasValueSatisfying assertion
mattbertolini Feb 8, 2025
c91cb6e
Add hasSizeLessThanOrEqualTo assertion
mattbertolini Feb 8, 2025
553d92c
Add hasKeySatisfying assertion
mattbertolini Feb 8, 2025
df7ca8b
Add hasDistinctSize assertion
mattbertolini Feb 8, 2025
7d14c3c
Add hasSize assertion
mattbertolini Feb 8, 2025
67a7351
Add hasSizeLessThan assertion
mattbertolini Feb 9, 2025
ab3f467
Add containsOnly assertion
mattbertolini Feb 9, 2025
d74a784
Add hasSizeGreaterThan assertion
mattbertolini Feb 9, 2025
ee3182c
Tweak condition
mattbertolini Feb 9, 2025
87e4429
Add README
mattbertolini Feb 9, 2025
1c31daa
Add hasSizeGreaterThanOrEqualTo assertion
mattbertolini Feb 9, 2025
a774277
Add containsValues assertion
mattbertolini Feb 9, 2025
b9777a5
Add license headers
mattbertolini Feb 9, 2025
5819acf
Remove package-info for now. I'll figure out if needed later.
mattbertolini Feb 9, 2025
2f67418
Use list factory method instead of array adapter
mattbertolini Feb 9, 2025
d75d93d
Add hasDistinctSizeGreaterThan assertion
mattbertolini Feb 9, 2025
446859f
Add license headers
mattbertolini Feb 9, 2025
fbe484a
Adding BDDAssertion support, javadoc
mattbertolini Feb 10, 2025
673bc25
Javadoc and polish
mattbertolini Feb 10, 2025
2694fa0
Add hasSizeBetween assertion
mattbertolini Feb 10, 2025
91e7739
Add license
mattbertolini Feb 10, 2025
8ffca9e
Add hasDistinctSizeGreaterThanOrEqualTo assertion
mattbertolini Feb 10, 2025
f4d2061
Clean up unchecked warnings
mattbertolini Feb 10, 2025
fce863f
Update scope
mattbertolini Feb 10, 2025
5cac9ce
Fixing javadoc warnings and adding docs
mattbertolini Feb 14, 2025
3f05941
Fix more javadoc warnings
mattbertolini Feb 14, 2025
30bd00f
Polishing
scordio Mar 29, 2025
2c1389f
Simplify test setup by simplifying the Multimap assert.
mattbertolini Apr 11, 2025
5a219c2
Tiny cleanup
mattbertolini May 14, 2025
e847dc1
Set to use Java 11 for bytecode
mattbertolini Jun 24, 2025
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AssertJ Eclipse Collections [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)

[![CI](https://github.com/assertj/assertj/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/assertj/assertj/actions/workflows/main.yml?query=branch%3Amain)
19 changes: 17 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
</license>
</licenses>

<developers>
<developer>
<id>mattbertolini</id>
<name>Matt Bertolini</name>
<url>https://github.com/mattbertolini</url>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/assertj/assertj-eclipse-collections.git</connection>
<developerConnection>scm:git:https://github.com/assertj/assertj-eclipse-collections.git</developerConnection>
Expand All @@ -31,9 +39,10 @@

<properties>
<assertj.version>3.27.3</assertj.version>
<java.version>11</java.version>
<eclipse-collections.version>12.0.0</eclipse-collections.version>
<!-- Dependency versions overriding -->
<junit-jupiter.version>5.11.4</junit-jupiter.version>
<junit-jupiter.version>5.12.1</junit-jupiter.version>
</properties>

<dependencies>
Expand All @@ -46,10 +55,16 @@
<!-- Provided -->
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections-api</artifactId>
<artifactId>eclipse-collections</artifactId>
<version>${eclipse-collections.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.opentest4j</groupId>
<artifactId>opentest4j</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
33 changes: 0 additions & 33 deletions src/main/java/org/assertj/eclipse/collections/Main.java

This file was deleted.

43 changes: 43 additions & 0 deletions src/main/java/org/assertj/eclipse/collections/api/Assertions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* 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 2025-2025 the original author or authors.
*/
package org.assertj.eclipse.collections.api;

import org.assertj.core.util.CheckReturnValue;
import org.assertj.eclipse.collections.api.multimap.MultimapAssert;
import org.eclipse.collections.api.multimap.Multimap;

/**
* Entry point for assertion methods for the Eclipse Collections library. Each method in this class is a static factory
* for a type-specific assertion object.
*/
@CheckReturnValue
public class Assertions {
/**
* Creates a new {@link Assertions}.
*/
protected Assertions() {
// Do nothing
}

/**
* Creates a new instance of {@link MultimapAssert}.
*
* @param actual the actual value.
* @return the created assertion object.
* @param <KEY> The type of keys in the BagMultimap
* @param <VALUE> The type of values in the BagMultimap
*/
public static <KEY, VALUE> MultimapAssert<KEY, VALUE> assertThat(Multimap<KEY, VALUE> actual) {
return new MultimapAssert<>(actual);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* 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 2025-2025 the original author or authors.
*/
package org.assertj.eclipse.collections.api;

import org.assertj.core.util.CheckReturnValue;
import org.assertj.eclipse.collections.api.multimap.MultimapAssert;
import org.eclipse.collections.api.multimap.Multimap;

/**
* Behavior-driven development style entry point for assertion methods for the Eclipse Collections library. Each method
* in this class is a static factory for a type-specific assertion object.
*/
@CheckReturnValue
public class BDDAssertions extends Assertions {
/**
* Creates a new <code>{@link BDDAssertions}</code>.
*/
protected BDDAssertions() {
// Do nothing
}

/**
* Creates a new instance of {@link MultimapAssert}.
*
* @param actual the actual value.
* @return the created assertion object.
* @param <KEY> The type of keys in the BagMultimap
* @param <VALUE> The type of values in the BagMultimap
*/
public static <KEY, VALUE> MultimapAssert<KEY, VALUE> then(Multimap<KEY, VALUE> actual) {
return assertThat(actual);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* 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 2025-2025 the original author or authors.
*/
package org.assertj.eclipse.collections.api;

import org.assertj.core.api.SoftAssertionsProvider;
import org.assertj.core.util.CheckReturnValue;
import org.assertj.eclipse.collections.api.multimap.MultimapAssert;
import org.eclipse.collections.api.multimap.Multimap;

/**
* Soft assertions implementations for Eclipse Collections types.
*/
@CheckReturnValue
public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider {
/**
* Creates a new, proxied instance of a {@link MultimapAssert}
*
* @param actual the path
* @return the created assertion object
* @param <KEY> The type of keys in the actual BagMultimap
* @param <VALUE> The type of values in the actual BagMultimap
*/
@SuppressWarnings("unchecked")
default <KEY, VALUE> MultimapAssert<KEY, VALUE> assertThat(Multimap<KEY, VALUE> actual) {
return this.proxy(MultimapAssert.class, Multimap.class, actual);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* 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 2025-2025 the original author or authors.
*/
package org.assertj.eclipse.collections.api;

import org.assertj.core.api.AbstractSoftAssertions;
import org.assertj.core.api.SoftAssertionsProvider;
import org.opentest4j.MultipleFailuresError;

import java.util.function.Consumer;

/**
* A soft assertions provider for Eclipse Collections assertions
*/
public class SoftAssertions extends AbstractSoftAssertions implements EclipseCollectionsSoftAssertionsProvider {
/**
* Creates a new {@link SoftAssertions}.
*/
public SoftAssertions() {
// Do nothing
}

/**
* Convenience method for calling {@link EclipseCollectionsSoftAssertionsProvider#assertSoftly} for these assertion
* types. Equivalent to {@code SoftAssertion.assertSoftly(SoftAssertions.class, softly)}.
*
* @param softly the Consumer containing the code that will make the soft assertions.
* Takes one parameter (the SoftAssertions instance used to make the assertions).
* @throws MultipleFailuresError if possible or SoftAssertionError if any proxied assertion objects threw an {@link
* AssertionError}
*/
public static void assertSoftly(Consumer<SoftAssertions> softly) {
SoftAssertionsProvider.assertSoftly(SoftAssertions.class, softly);
}
}
Loading