2323import static com .exonum .binding .core .storage .indices .TestStorageItems .V1 ;
2424import static com .exonum .binding .core .storage .indices .TestStorageItems .values ;
2525import static com .exonum .binding .test .Bytes .createPrefixed ;
26- import static org . hamcrest . CoreMatchers . equalTo ;
26+ import static com . google . common . collect . ImmutableList . toImmutableList ;
2727import static org .hamcrest .MatcherAssert .assertThat ;
2828import static org .junit .jupiter .api .Assertions .assertThrows ;
2929
3333import com .exonum .binding .core .storage .database .View ;
3434import com .exonum .binding .test .Bytes ;
3535import com .exonum .binding .test .CiOnly ;
36- import com .google .common .collect .ImmutableList ;
37- import com .google .common .primitives .UnsignedBytes ;
3836import java .util .ArrayList ;
3937import java .util .Arrays ;
4038import java .util .BitSet ;
41- import java .util .Iterator ;
4239import java .util .List ;
43- import java .util .stream .Collectors ;
4440import java .util .stream .Stream ;
4541import org .junit .jupiter .api .Test ;
4642
4743class ProofMapIndexProxyNoKeyHashingIntegrationTest
4844 extends BaseProofMapIndexProxyIntegrationTestable {
4945
50- static final List <HashCode > SORTED_TEST_KEYS = Stream .of (
46+ static final List <HashCode > TEST_KEYS = Stream .of (
5147 Bytes .bytes (0x00 ),
5248 Bytes .bytes (0x01 ),
5349 Bytes .bytes (0x02 ),
@@ -64,15 +60,14 @@ class ProofMapIndexProxyNoKeyHashingIntegrationTest
6460 Bytes .bytes (0x10 , 0x10 )
6561 )
6662 .map (BaseProofMapIndexProxyIntegrationTestable ::createRawProofKey )
67- .sorted (UnsignedBytes .lexicographicalComparator ())
6863 .map (HashCode ::fromBytes )
69- .collect (Collectors . toList ());
64+ .collect (toImmutableList ());
7065
7166 private static final HashCode INVALID_PROOF_KEY = HashCode .fromString ("1234" );
7267
7368 @ Override
7469 List <HashCode > getTestKeys () {
75- return SORTED_TEST_KEYS ;
70+ return TEST_KEYS ;
7671 }
7772
7873 @ Override
@@ -110,52 +105,6 @@ void removeFailsIfInvalidKey() {
110105 (map ) -> assertThrows (IllegalArgumentException .class , () -> map .remove (INVALID_PROOF_KEY )));
111106 }
112107
113- @ Test
114- void keysTest () {
115- runTestWithView (database ::createFork , (map ) -> {
116- List <MapEntry <HashCode , String >> entries = createSortedMapEntries ();
117-
118- putAll (map , entries );
119-
120- Iterator <HashCode > keysIterator = map .keys ();
121- List <HashCode > keysFromIter = ImmutableList .copyOf (keysIterator );
122- List <HashCode > keysInMap = MapEntries .extractKeys (entries );
123-
124- // Keys must appear in a lexicographical order.
125- assertThat (keysFromIter , equalTo (keysInMap ));
126- });
127- }
128-
129- @ Test
130- void valuesTest () {
131- runTestWithView (database ::createFork , (map ) -> {
132- List <MapEntry <HashCode , String >> entries = createSortedMapEntries ();
133-
134- putAll (map , entries );
135-
136- Iterator <String > valuesIterator = map .values ();
137- List <String > valuesFromIter = ImmutableList .copyOf (valuesIterator );
138- List <String > valuesInMap = MapEntries .extractValues (entries );
139-
140- // Values must appear in a lexicographical order of keys.
141- assertThat (valuesFromIter , equalTo (valuesInMap ));
142- });
143- }
144-
145- @ Test
146- void entriesTest () {
147- runTestWithView (database ::createFork , (map ) -> {
148- List <MapEntry <HashCode , String >> entries = createSortedMapEntries ();
149-
150- putAll (map , entries );
151-
152- Iterator <MapEntry <HashCode , String >> entriesIterator = map .entries ();
153- List <MapEntry > entriesFromIter = ImmutableList .copyOf (entriesIterator );
154- // Entries must appear in a lexicographical order of keys.
155- assertThat (entriesFromIter , equalTo (entries ));
156- });
157- }
158-
159108 @ Test
160109 @ DisabledProofTest
161110 void getProof_FourEntryMap_LastByte_Contains1 () {
@@ -429,14 +378,6 @@ private static byte[] keyFromString(String prefix) {
429378 return createPrefixed (keyPrefixBits .toByteArray (), PROOF_MAP_KEY_SIZE );
430379 }
431380
432- /**
433- * Creates `numOfEntries` map entries, sorted by key:
434- * [(00…0PK1, V1), (00…0PK2, V2), … (00…0PKi, Vi)].
435- */
436- List <MapEntry <HashCode , String >> createSortedMapEntries () {
437- return createMapEntries (SORTED_TEST_KEYS .stream ());
438- }
439-
440381 /**
441382 * Creates 257 entries for a ProofMap that, when added to it, will make the underlying
442383 * Merkle-Patricia tree of the maximum height (256). Leaf nodes will be at depths
0 commit comments