-
Notifications
You must be signed in to change notification settings - Fork 0
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
kaklakariada
committed
Nov 13, 2024
1 parent
c5bfc2b
commit 58bbd51
Showing
6 changed files
with
66 additions
and
4 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
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
53 changes: 53 additions & 0 deletions
53
src/test/java/org/itsallcode/matcher/auto/AutoMatcherSetTest.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,53 @@ | ||
package org.itsallcode.matcher.auto; | ||
|
||
import static java.util.Collections.emptySet; | ||
import static org.itsallcode.matcher.auto.TestUtil.assertValuesDoNotMatch; | ||
import static org.itsallcode.matcher.auto.TestUtil.assertValuesMatch; | ||
|
||
import java.util.*; | ||
|
||
import org.itsallcode.matcher.model.DemoAttribute; | ||
import org.junit.jupiter.api.RepeatedTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class AutoMatcherSetTest { | ||
|
||
@Test | ||
void testEmptySet() { | ||
assertValuesDoNotMatch(emptySet(), Set.of("value2")); | ||
} | ||
|
||
@Test | ||
void testIncompatibleMemberTypes() { | ||
assertValuesDoNotMatch(Set.of("string"), Set.of(1)); | ||
} | ||
|
||
@Test | ||
void testIncompatibleMemberTypesComplexTypes() { | ||
assertValuesDoNotMatch(Set.of(new DemoAttribute("attr")), Set.of(1)); | ||
} | ||
|
||
@Test | ||
void testEmptySetAndNewHashSetList() { | ||
assertValuesMatch(emptySet(), new HashSet<>()); | ||
} | ||
|
||
@Test | ||
void testEmptySetAndNewTreeSet() { | ||
assertValuesMatch(emptySet(), new TreeSet<>()); | ||
} | ||
|
||
@Test | ||
void testEmptySetAndAsSetOfAreEqual() { | ||
assertValuesMatch(emptySet(), Set.of()); | ||
} | ||
|
||
@RepeatedTest(name = "ignores set order repetition {currentRepetition} of {totalRepetitions}", value = 50) | ||
void ignoresSetOrder() { | ||
|
||
final Set<String> set = new HashSet<>(); | ||
set.add("value1"); | ||
set.add("value2"); | ||
assertValuesMatch(Set.of("value1", "value2"), set); | ||
} | ||
} |