-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
138 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ier/internal/reflection/ModuleHelper.java → ...nternal/versionspecific/ModuleHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...er/internal/reflection/RecordsHelper.java → ...ternal/versionspecific/RecordsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nternal/reflection/SealedTypesHelper.java → ...al/versionspecific/SealedTypesHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nal/reflection/SealedTypesHelperTest.java → ...ersionspecific/SealedTypesHelperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...main/java/nl/jqno/equalsverifier/internal/versionspecific/SequencedCollectionsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package nl.jqno.equalsverifier.internal.versionspecific; | ||
|
||
import static nl.jqno.equalsverifier.internal.instantiation.vintage.prefabvalues.factories.Factories.collection; | ||
import static nl.jqno.equalsverifier.internal.instantiation.vintage.prefabvalues.factories.Factories.map; | ||
|
||
import java.util.*; | ||
|
||
import nl.jqno.equalsverifier.internal.instantiation.vintage.FactoryCache; | ||
|
||
public final class SequencedCollectionsHelper { | ||
|
||
private SequencedCollectionsHelper() {} | ||
|
||
public static void add(FactoryCache factoryCache) { | ||
factoryCache.put(SequencedCollection.class, collection(ArrayList::new)); | ||
factoryCache.put(SequencedSet.class, collection(LinkedHashSet::new)); | ||
factoryCache.put(SequencedMap.class, map(LinkedHashMap::new)); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...nl/jqno/equalsverifier/integration/extended_contract/SequencedCollectionsClassesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package nl.jqno.equalsverifier.integration.extended_contract; | ||
|
||
import java.util.*; | ||
|
||
import nl.jqno.equalsverifier.EqualsVerifier; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SequencedCollectionsClassesTest { | ||
|
||
@Test | ||
public void succeed_whenClassContainsSequencedCollections() { | ||
EqualsVerifier.forClass(SequencedCollectionContainer.class).verify(); | ||
} | ||
|
||
static final class SequencedCollectionContainer { | ||
|
||
private final SequencedCollection<String> collection; | ||
private final SequencedSet<String> set; | ||
private final SequencedMap<String, String> map; | ||
|
||
public SequencedCollectionContainer( | ||
SequencedCollection<String> collection, | ||
SequencedSet<String> set, | ||
SequencedMap<String, String> map) { | ||
this.collection = collection; | ||
this.set = set; | ||
this.map = map; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return this == obj | ||
|| (obj instanceof SequencedCollectionContainer other | ||
&& Objects.equals(collection, other.collection) | ||
&& Objects.equals(set, other.set) | ||
&& Objects.equals(map, other.map)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
// Trigger behavior that requires prefab values by calling abstract methods | ||
if (collection != null) { | ||
collection.reversed(); | ||
} | ||
if (set != null) { | ||
set.reversed(); | ||
} | ||
if (map != null) { | ||
map.reversed(); | ||
} | ||
return Objects.hash(collection, set, map); | ||
} | ||
|
||
protected void callIterator(Iterable<?>... collections) { | ||
for (Iterable<?> c : collections) { | ||
if (c != null) { | ||
c.iterator(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
equalsverifier-core/src/main/java/nl/jqno/equalsverifier/internal/util/ErrorMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ier/internal/reflection/ModuleHelper.java → ...nternal/versionspecific/ModuleHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...er/internal/reflection/RecordsHelper.java → ...ternal/versionspecific/RecordsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nternal/reflection/SealedTypesHelper.java → ...al/versionspecific/SealedTypesHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...main/java/nl/jqno/equalsverifier/internal/versionspecific/SequencedCollectionsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package nl.jqno.equalsverifier.internal.versionspecific; | ||
|
||
import nl.jqno.equalsverifier.internal.instantiation.vintage.FactoryCache; | ||
|
||
public final class SequencedCollectionsHelper { | ||
|
||
private SequencedCollectionsHelper() {} | ||
|
||
public static void add(FactoryCache factoryCache) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters