Skip to content

Commit

Permalink
Rework test fixtures
Browse files Browse the repository at this point in the history
Next, grow the amount of data tested to find bugs in the tests with
non-repeatable map ordering
  • Loading branch information
garydgregory committed Mar 30, 2024
1 parent 896d4a0 commit feccdaf
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public MultiValuedMap<K, V> getMap() {
*/
@SuppressWarnings("unchecked")
public K[] getSampleKeys() {
final Object[] result = { "k0", "k0", "k1", "k1", "k2", "k2" };
final Object[] result = new Object[getSampleSize()];
int k = 0;
for (int i = 0; i < result.length; i += 2, k++) {
final String key = "k" + Integer.valueOf(k);
Expand All @@ -530,6 +530,10 @@ public K[] getSampleKeys() {
return (K[]) result;
}

public int getSampleSize() {
return 6;
}

/**
* Returns the set of values in the mappings used to test the map. This
* method must return an array with the same length as
Expand All @@ -538,10 +542,7 @@ public K[] getSampleKeys() {
*/
@SuppressWarnings("unchecked")
public V[] getSampleValues() {
final Object[] result = {
"v1_b", "v0_b", "v1_a", "v1_b",
"v2_a", "v2_b"
};
final Object[] result = new Object[getSampleSize()];
int k = 0;
for (int i = 0; i < result.length; i += 2, k++) {
final String key = "v" + Integer.valueOf(k);
Expand Down

0 comments on commit feccdaf

Please sign in to comment.