diff --git a/atlasdb-api/src/test/java/com/palantir/atlasdb/keyvalue/api/AtlasLockDescriptorUtilsTest.java b/atlasdb-api/src/test/java/com/palantir/atlasdb/keyvalue/api/AtlasLockDescriptorUtilsTest.java index 61cdcb296fe..e205d613632 100644 --- a/atlasdb-api/src/test/java/com/palantir/atlasdb/keyvalue/api/AtlasLockDescriptorUtilsTest.java +++ b/atlasdb-api/src/test/java/com/palantir/atlasdb/keyvalue/api/AtlasLockDescriptorUtilsTest.java @@ -83,7 +83,7 @@ public void rowWithNullsParsesAllCombinationsForCells() { Cell.create(new byte[] {1, 0, 2}, new byte[] {3, 0, 4, 5, 6}), Cell.create(new byte[] {1, 0, 2, 0, 3}, new byte[] {4, 5, 6})); - assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).isEqualTo(expected); + assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).containsExactlyElementsOf(expected); assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)) .contains(CellReference.of(TABLE, Cell.create(ROW_WITH_ZEROS, NO_ZERO_COL))); } @@ -97,7 +97,7 @@ public void colWithNullsParsesAllCombinationsForCells() { Cell.create(new byte[] {1, 2, 3, 0, 4}, new byte[] {0, 5, 6}), Cell.create(new byte[] {1, 2, 3, 0, 4, 0}, new byte[] {5, 6})); - assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).isEqualTo(expected); + assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).containsExactlyElementsOf(expected); assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)) .contains(CellReference.of(TABLE, Cell.create(NO_ZERO_ROW, COL_WITH_ZEROS))); } @@ -110,7 +110,7 @@ public void rowEndingWithZeroIsCorrectlyParsedForCombinationsForCells() { Cell.create(new byte[] {4, 5, 6}, new byte[] {0, 4, 5, 6}), Cell.create(new byte[] {4, 5, 6, 0}, new byte[] {4, 5, 6})); - assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).isEqualTo(expected); + assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)).containsExactlyElementsOf(expected); assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)) .contains(CellReference.of(TABLE, Cell.create(END_WITH_ZERO, NO_ZERO_COL))); } diff --git a/atlasdb-cassandra-integration-tests/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraKeyValueServiceIntegrationTest.java b/atlasdb-cassandra-integration-tests/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraKeyValueServiceIntegrationTest.java index 9d0e8804ba4..dd82965827e 100644 --- a/atlasdb-cassandra-integration-tests/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraKeyValueServiceIntegrationTest.java +++ b/atlasdb-cassandra-integration-tests/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraKeyValueServiceIntegrationTest.java @@ -358,7 +358,7 @@ public void testGetRows_manyColumnRows() { Map result = keyValueService.getRows( tableReference, ImmutableList.of(row1), ColumnSelection.all(), STARTING_ATLAS_TIMESTAMP - 1); - assertThat(result).isEqualTo(tableValues); + assertThat(result).containsExactlyInAnyOrderEntriesOf(tableValues); } @Test diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/ThriftObjectSizeUtilsTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/ThriftObjectSizeUtilsTest.java index 27a302938cb..736d7764840 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/ThriftObjectSizeUtilsTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/ThriftObjectSizeUtilsTest.java @@ -229,7 +229,7 @@ public void getSizeOfMutationPerTableOnBatchMutate() { long expectedSize = EMPTY_COLUMN_OR_SUPERCOLUMN_SIZE + NULL_SIZE + TEST_NAME_BYTES_SIZE; assertThat(ThriftObjectSizeUtils.getSizeOfMutationPerTable(batchMutateMap)) - .isEqualTo(ImmutableMap.of(TEST_NAME, expectedSize)); + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(TEST_NAME, expectedSize)); } @Test diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraTimestampUtilsTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraTimestampUtilsTest.java index 0cd9ed926f1..6f1dc0d2a03 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraTimestampUtilsTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraTimestampUtilsTest.java @@ -60,7 +60,7 @@ public void canGetValuesFromSelectionResult() { CqlResult mockResult = createMockCqlResult(ImmutableList.of(createMockCqlRow(columnList1), createMockCqlRow(columnList2))); assertThat(CassandraTimestampUtils.getValuesFromSelectionResult(mockResult)) - .isEqualTo(ImmutableMap.of(COLUMN_NAME_1, VALUE_1, COLUMN_NAME_2, VALUE_2)); + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(COLUMN_NAME_1, VALUE_1, COLUMN_NAME_2, VALUE_2)); } @Test diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraVerifierTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraVerifierTest.java index 523eeef66db..9e8ec9c9763 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraVerifierTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraVerifierTest.java @@ -169,7 +169,7 @@ public void freshInstanceSetsStrategyOptions() throws TException { when(config.replicationFactor()).thenReturn(3); KsDef ksDef = CassandraVerifier.createKsDefForFresh(client, config); - assertThat(ksDef.strategy_options).isEqualTo(ImmutableMap.of(DC_1, "3", DC_2, "3")); + assertThat(ksDef.strategy_options).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(DC_1, "3", DC_2, "3")); } @Test @@ -183,7 +183,7 @@ public void simpleStrategyOneDcOneRfSucceedsAndUpdatesKsDef() throws TException ksDef = CassandraVerifier.checkAndSetReplicationFactor(client, ksDef, config); assertThat(ksDef.strategy_class).isEqualTo(CassandraConstants.NETWORK_STRATEGY); - assertThat(ksDef.strategy_options).isEqualTo(ImmutableMap.of(DC_1, "1")); + assertThat(ksDef.strategy_options).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(DC_1, "1")); } @Test @@ -222,7 +222,7 @@ public void returnSameKsDefIfNodeTopologyChecksIgnored() throws TException { ksDef = CassandraVerifier.checkAndSetReplicationFactor(client, ksDef, config); assertThat(ksDef.strategy_class).isEqualTo(CassandraConstants.SIMPLE_STRATEGY); - assertThat(ksDef.strategy_options).isEqualTo(strategyOptions); + assertThat(ksDef.strategy_options).containsExactlyInAnyOrderEntriesOf(strategyOptions); } @Test @@ -239,7 +239,7 @@ public void networkStrategyMultipleDcsSucceeds() throws TException { ksDef.setStrategy_options(strategyOptions); ksDef = CassandraVerifier.checkAndSetReplicationFactor(client, ksDef, config); - assertThat(ksDef.strategy_options).isEqualTo(strategyOptions); + assertThat(ksDef.strategy_options).containsExactlyInAnyOrderEntriesOf(strategyOptions); } @Test diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/ProfilingCassandraClientTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/ProfilingCassandraClientTest.java index 13841a610cd..580ef29f8a8 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/ProfilingCassandraClientTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/ProfilingCassandraClientTest.java @@ -98,7 +98,7 @@ public void handlesNullMultigetSliceResponseFromDelegate() throws TException { ImmutableList.of(byteBuffer), new SlicePredicate(), ConsistencyLevel.QUORUM)) - .isEqualTo(resultMap); + .containsExactlyInAnyOrderEntriesOf(resultMap); verify(delegate) .multiget_slice( diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/CassandraServiceTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/CassandraServiceTest.java index c3bd847ab11..6c71a3c2bcd 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/CassandraServiceTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/CassandraServiceTest.java @@ -61,7 +61,7 @@ public void shouldOnlyReturnLocalHosts() { cassandra.setLocalHosts(localHosts); - assertThat(cassandra.maybeFilterLocalHosts(hosts)).isEqualTo(localHosts); + assertThat(cassandra.maybeFilterLocalHosts(hosts)).containsExactlyInAnyOrderElementsOf(localHosts); } @Test @@ -73,7 +73,7 @@ public void shouldReturnAllHostsBySkippingFilter() { cassandra.setLocalHosts(localHosts); - assertThat(cassandra.maybeFilterLocalHosts(hosts)).isEqualTo(hosts); + assertThat(cassandra.maybeFilterLocalHosts(hosts)).containsExactlyInAnyOrderElementsOf(hosts); } @Test @@ -85,7 +85,7 @@ public void shouldReturnAllHostsAsNoIntersection() { cassandra.setLocalHosts(localHosts); - assertThat(cassandra.maybeFilterLocalHosts(hosts)).isEqualTo(hosts); + assertThat(cassandra.maybeFilterLocalHosts(hosts)).containsExactlyInAnyOrderElementsOf(hosts); } @Test diff --git a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/WeightedHostsTest.java b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/WeightedHostsTest.java index 5cb5058b966..cf4126f3124 100644 --- a/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/WeightedHostsTest.java +++ b/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/keyvalue/cassandra/pool/WeightedHostsTest.java @@ -141,7 +141,7 @@ public void testSelectingHostFromWeightedHostsMatchesWeight() { numTimesSelected.put(host, numTimesSelected.get(host) + 1); } - assertThat(numTimesSelected).isEqualTo(hostsToWeight); + assertThat(numTimesSelected).containsExactlyInAnyOrderEntriesOf(hostsToWeight); } private static CassandraClientPoolingContainer createMockClientPoolingContainerWithUtilization(int utilization) { diff --git a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestKvsMigrationCommand.java b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestKvsMigrationCommand.java index 427da16c002..e8bfb511fc0 100644 --- a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestKvsMigrationCommand.java +++ b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestKvsMigrationCommand.java @@ -138,7 +138,7 @@ private void checkKvs(AtlasDbServices services, int numTables, int numEntriesPer } Map expected = expectedBuilder.build(); Map result = t.get(table, expected.keySet()); - assertThat(result.keySet()).isEqualTo(expected.keySet()); + assertThat(result.keySet()).containsExactlyInAnyOrderElementsOf(expected.keySet()); for (Map.Entry e : result.entrySet()) { assertThat(e.getValue()).isEqualTo(expected.get(e.getKey())); } diff --git a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestScrubQueueMigrationCommand.java b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestScrubQueueMigrationCommand.java index 7c1003bd727..4df316f0890 100644 --- a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestScrubQueueMigrationCommand.java +++ b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestScrubQueueMigrationCommand.java @@ -83,7 +83,7 @@ public void testScrubQueueMigration() { scrubStore.getBatchingVisitableScrubQueue( Long.MAX_VALUE, PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY); assertThat(Iterables.getOnlyElement(BatchingVisitables.copyToList(visitable))) - .isEqualTo(ImmutableSortedMap.of( + .containsExactlyInAnyOrderEntriesOf(ImmutableSortedMap.of( 10L, ImmutableMultimap.of(foo, cell1, bar, cell1), 20L, ImmutableMultimap.of(baz, cell1), 30L, ImmutableMultimap.of(foo, cell2), diff --git a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestSweepCommand.java b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestSweepCommand.java index 9e1491ae871..26df582aeb5 100644 --- a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestSweepCommand.java +++ b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/TestSweepCommand.java @@ -124,10 +124,10 @@ public void testSweepTable() throws Exception { assertThat(get(kvs, TABLE_ONE, "foo", ts5)).isEqualTo("baz"); assertThat(get(kvs, TABLE_ONE, "foo", mid(ts1, ts3))).isEqualTo(deletedValue("bar")); - assertThat(getAllTs(kvs, TABLE_ONE, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts1), ts3)); + assertThat(getAllTs(kvs, TABLE_ONE, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts1), ts3); assertThat(get(kvs, TABLE_TWO, "foo", ts5)).isEqualTo("taz"); assertThat(get(kvs, TABLE_TWO, "foo", mid(ts3, ts4))).isEqualTo("tar"); - assertThat(getAllTs(kvs, TABLE_TWO, "foo")).isEqualTo(ImmutableSet.of(ts2, ts4)); + assertThat(getAllTs(kvs, TABLE_TWO, "foo")).containsExactlyInAnyOrder(ts2, ts4); } } @@ -168,13 +168,13 @@ public void testSweepNamespace() throws Exception { assertThat(get(kvs, TABLE_ONE, "foo", ts7)).isEqualTo("baz"); assertThat(get(kvs, TABLE_ONE, "foo", mid(ts1, ts2))).isEqualTo(deletedValue("bar")); - assertThat(getAllTs(kvs, TABLE_ONE, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts1), ts4)); + assertThat(getAllTs(kvs, TABLE_ONE, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts1), ts4); assertThat(get(kvs, TABLE_TWO, "foo", ts7)).isEqualTo("taz"); assertThat(get(kvs, TABLE_TWO, "foo", mid(ts4, ts6))).isEqualTo(deletedValue("tar")); - assertThat(getAllTs(kvs, TABLE_TWO, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts2), ts6)); + assertThat(getAllTs(kvs, TABLE_TWO, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts2), ts6); assertThat(get(kvs, TABLE_THREE, "foo", ts7)).isEqualTo("jaz"); assertThat(get(kvs, TABLE_THREE, "foo", mid(ts3, ts5))).isEqualTo("jar"); - assertThat(getAllTs(kvs, TABLE_THREE, "foo")).isEqualTo(ImmutableSet.of(ts3, ts5)); + assertThat(getAllTs(kvs, TABLE_THREE, "foo")).containsExactlyInAnyOrder(ts3, ts5); } } @@ -200,13 +200,13 @@ public void testSweepAll() throws Exception { assertThat(get(kvs, TABLE_ONE, "foo", ts7)).isEqualTo("baz"); assertThat(get(kvs, TABLE_ONE, "foo", mid(ts1, ts2))).isEqualTo(deletedValue("bar")); - assertThat(getAllTs(kvs, TABLE_ONE, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts1), ts4)); + assertThat(getAllTs(kvs, TABLE_ONE, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts1), ts4); assertThat(get(kvs, TABLE_TWO, "foo", ts7)).isEqualTo("taz"); assertThat(get(kvs, TABLE_TWO, "foo", mid(ts4, ts6))).isEqualTo(deletedValue("tar")); - assertThat(getAllTs(kvs, TABLE_TWO, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts2), ts6)); + assertThat(getAllTs(kvs, TABLE_TWO, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts2), ts6); assertThat(get(kvs, TABLE_THREE, "foo", ts7)).isEqualTo("jaz"); assertThat(get(kvs, TABLE_THREE, "foo", mid(ts3, ts5))).isEqualTo(deletedValue("jar")); - assertThat(getAllTs(kvs, TABLE_THREE, "foo")).isEqualTo(ImmutableSet.of(deletedTimestamp(ts3), ts5)); + assertThat(getAllTs(kvs, TABLE_THREE, "foo")).containsExactlyInAnyOrder(deletedTimestamp(ts3), ts5); } } @@ -236,8 +236,9 @@ public void testSweepStartRow() throws Exception { assertThat(get(kvs, TABLE_ONE, "foo", mid(ts2, ts4))).isEqualTo(deletedValue("biz")); assertThat(get(kvs, TABLE_ONE, "boo", mid(ts3, ts5))).isEqualTo("biz"); assertThat(getAllTs(kvs, TABLE_ONE, "foo")) - .isEqualTo(ImmutableSet.of(deletedTimestamp(ts1), deletedTimestamp(ts2), ts4)); - assertThat(getAllTs(kvs, TABLE_ONE, "boo")).isEqualTo(ImmutableSet.of(ts3)); + .containsExactlyInAnyOrderElementsOf( + ImmutableSet.of(deletedTimestamp(ts1), deletedTimestamp(ts2), ts4)); + assertThat(getAllTs(kvs, TABLE_ONE, "boo")).containsExactlyInAnyOrder(ts3); } } diff --git a/atlasdb-client/src/test/java/com/palantir/atlasdb/AtlasDbConstantsTest.java b/atlasdb-client/src/test/java/com/palantir/atlasdb/AtlasDbConstantsTest.java index 313a6288893..9a5a61a1bcd 100644 --- a/atlasdb-client/src/test/java/com/palantir/atlasdb/AtlasDbConstantsTest.java +++ b/atlasdb-client/src/test/java/com/palantir/atlasdb/AtlasDbConstantsTest.java @@ -27,6 +27,6 @@ public void allAtomicTablesHaveExplicitReadConsistencyDecision() { assertThat(Sets.union( AtlasDbConstants.NON_SERIAL_CONSISTENCY_ATOMIC_TABLES, AtlasDbConstants.SERIAL_CONSISTENCY_ATOMIC_TABLES)) - .isEqualTo(AtlasDbConstants.ATOMIC_TABLES); + .containsExactlyInAnyOrderElementsOf(AtlasDbConstants.ATOMIC_TABLES); } } diff --git a/atlasdb-client/src/test/java/com/palantir/atlasdb/keyvalue/impl/TracingKeyValueServiceTest.java b/atlasdb-client/src/test/java/com/palantir/atlasdb/keyvalue/impl/TracingKeyValueServiceTest.java index 70b5b155afe..1f0e68e02c4 100644 --- a/atlasdb-client/src/test/java/com/palantir/atlasdb/keyvalue/impl/TracingKeyValueServiceTest.java +++ b/atlasdb-client/src/test/java/com/palantir/atlasdb/keyvalue/impl/TracingKeyValueServiceTest.java @@ -199,7 +199,7 @@ public void get() throws Exception { Map result = kvs.get(TABLE_REF, cells); - assertThat(result).isEqualTo(expectedResult); + assertThat(result).containsExactlyInAnyOrderEntriesOf(expectedResult); checkSpan("atlasdb-kvs.get", ImmutableMap.of("table", "{table}", "cells", "1")); verify(delegate).get(TABLE_REF, cells); verifyNoMoreInteractions(delegate); @@ -241,7 +241,7 @@ public void getFirstBatchForRanges() { Map, byte[]>> result = kvs.getFirstBatchForRanges(TABLE_REF, RANGE_REQUESTS, TIMESTAMP); - assertThat(result).isEqualTo(expectedResult); + assertThat(result).containsExactlyInAnyOrderEntriesOf(expectedResult); checkSpan("atlasdb-kvs.getFirstBatchForRanges", ImmutableMap.of("table", "{table}", "ranges", "1", "ts", "2")); verify(delegate).getFirstBatchForRanges(TABLE_REF, RANGE_REQUESTS, TIMESTAMP); verifyNoMoreInteractions(delegate); @@ -279,7 +279,7 @@ public void getMetadataForTables() { Map result = kvs.getMetadataForTables(); - assertThat(result).isEqualTo(expectedResult); + assertThat(result).containsExactlyInAnyOrderEntriesOf(expectedResult); checkSpan("atlasdb-kvs.getMetadataForTables"); verify(delegate).getMetadataForTables(); verifyNoMoreInteractions(delegate); @@ -294,7 +294,7 @@ public void getRows() throws Exception { Map result = kvs.getRows(TABLE_REF, rows, ColumnSelection.all(), TIMESTAMP); - assertThat(result).isEqualTo(expectedResult); + assertThat(result).containsExactlyInAnyOrderEntriesOf(expectedResult); checkSpan("atlasdb-kvs.getRows", ImmutableMap.of("table", "{table}", "rows", "1", "ts", "2")); verify(delegate).getRows(TABLE_REF, rows, ColumnSelection.all(), TIMESTAMP); verifyNoMoreInteractions(delegate); @@ -310,7 +310,7 @@ public void getRowsColumnRangeBatch() { Map result = kvs.getRowsColumnRange(TABLE_REF, rows, range, TIMESTAMP); - assertThat(result).isEqualTo(expectedResult); + assertThat(result).containsExactlyInAnyOrderEntriesOf(expectedResult); checkSpan("atlasdb-kvs.getRowsColumnRange", ImmutableMap.of("table", "{table}", "rows", "1", "ts", "2")); verify(delegate).getRowsColumnRange(TABLE_REF, rows, range, TIMESTAMP); verifyNoMoreInteractions(delegate); diff --git a/atlasdb-client/src/test/java/com/palantir/atlasdb/table/description/AbstractSchemaApiTest.java b/atlasdb-client/src/test/java/com/palantir/atlasdb/table/description/AbstractSchemaApiTest.java index 2902dda1834..36d17d46fc4 100644 --- a/atlasdb-client/src/test/java/com/palantir/atlasdb/table/description/AbstractSchemaApiTest.java +++ b/atlasdb-client/src/test/java/com/palantir/atlasdb/table/description/AbstractSchemaApiTest.java @@ -141,7 +141,9 @@ public void testGetMultipleRowsFirstColumn() { Map result = getMultipleRowsFirstColumn(transaction, Arrays.asList(TEST_ROW_KEY, TEST_ROW_KEY2)); - assertThat(result).isEqualTo(ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_LONG, TEST_ROW_KEY2, TEST_VALUE_LONG2)); + assertThat(result) + .containsExactlyInAnyOrderEntriesOf( + ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_LONG, TEST_ROW_KEY2, TEST_VALUE_LONG2)); ArgumentCaptor> argument = ArgumentCaptor.forClass(Iterable.class); verify(transaction, times(1)).getRows(eq(tableRef), argument.capture(), eq(FIRST_COLUMN_SELECTION)); @@ -173,7 +175,8 @@ public void testRowRangeSecondColumn() { Map result = getRangeSecondColumn(transaction, TEST_ROW_KEY, RANGE_END_ROW_KEY); assertThat(result) - .isEqualTo(ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_STRING, TEST_ROW_KEY2, TEST_VALUE_STRING2)); + .containsExactlyInAnyOrderEntriesOf( + ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_STRING, TEST_ROW_KEY2, TEST_VALUE_STRING2)); verify(transaction, times(1)).getRange(tableRef, expectedRange); } @@ -201,7 +204,8 @@ public void testRowRangeSecondColumnFirstTwoResults() { getRangeSecondColumnOnlyFirstTwoResults(transaction, TEST_ROW_KEY, RANGE_END_ROW_KEY); assertThat(result) - .isEqualTo(ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_STRING, TEST_ROW_KEY2, TEST_VALUE_STRING2)); + .containsExactlyInAnyOrderEntriesOf( + ImmutableMap.of(TEST_ROW_KEY, TEST_VALUE_STRING, TEST_ROW_KEY2, TEST_VALUE_STRING2)); verify(transaction, times(1)).getRange(tableRef, expectedRange); } diff --git a/atlasdb-commons/src/test/java/com/palantir/common/base/BatchingVisitablesTest.java b/atlasdb-commons/src/test/java/com/palantir/common/base/BatchingVisitablesTest.java index b6c70e1c946..7b81fccd01e 100644 --- a/atlasdb-commons/src/test/java/com/palantir/common/base/BatchingVisitablesTest.java +++ b/atlasdb-commons/src/test/java/com/palantir/common/base/BatchingVisitablesTest.java @@ -65,7 +65,9 @@ public void testGetFirstPage() { assertThat(page.getResults()) .describedAs("page results had wrong size!") .hasSize(1); - assertThat(page.getResults()).describedAs("page.getResults was wrong").isEqualTo(Lists.newArrayList(0L)); + assertThat(page.getResults()) + .describedAs("page.getResults was wrong") + .containsExactlyElementsOf(Lists.newArrayList(0L)); assertThat(page.moreResultsAvailable()) .describedAs("page.moreResultsAvailable was wrong") .isTrue(); @@ -76,7 +78,7 @@ public void testGetFirstPage() { .hasSize(3); assertThat(page.getResults()) .describedAs("page.getResults was wrong") - .isEqualTo(Lists.newArrayList(0L, 1L, 2L)); + .containsExactlyElementsOf(Lists.newArrayList(0L, 1L, 2L)); assertThat(page.moreResultsAvailable()) .describedAs("page.moreResultsAvailable was wrong") .isTrue(); @@ -87,7 +89,7 @@ public void testGetFirstPage() { .hasSize(4); assertThat(page.getResults()) .describedAs("page.getResults was wrong") - .isEqualTo(Lists.newArrayList(0L, 1L, 2L, 3L)); + .containsExactlyElementsOf(Lists.newArrayList(0L, 1L, 2L, 3L)); assertThat(page.moreResultsAvailable()) .describedAs("page.moreResultsAvailable was wrong") .isFalse(); @@ -98,7 +100,7 @@ public void testGetFirstPage() { .hasSize(4); assertThat(page.getResults()) .describedAs("page.getResults was wrong") - .isEqualTo(Lists.newArrayList(0L, 1L, 2L, 3L)); + .containsExactlyElementsOf(Lists.newArrayList(0L, 1L, 2L, 3L)); assertThat(page.moreResultsAvailable()) .describedAs("page.moreResultsAvailable was wrong") .isFalse(); @@ -255,7 +257,7 @@ public void testUnique() { BatchingVisitableView bv = BatchingVisitableView.of(visitor); assertThat(bv.unique().limit(4).immutableCopy()) .describedAs("unexpected result for unique view") - .isEqualTo(ImmutableList.of(0L, 1L, 2L, 3L)); + .containsExactly(0L, 1L, 2L, 3L); } @Test @@ -263,7 +265,7 @@ public void testLimit() { BatchingVisitable visitor = ListVisitor.create(Lists.newArrayList(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L)); BatchingVisitableView limited = BatchingVisitableView.of(visitor).limit(3); ImmutableList copy = limited.immutableCopy(); - assertThat(copy).describedAs("limit produced unexpected result").isEqualTo(ImmutableList.of(0L, 1L, 2L)); + assertThat(copy).describedAs("limit produced unexpected result").containsExactly(0L, 1L, 2L); assertThat(limited.batchAccept(1, AbortingVisitors.alwaysFalse())) .describedAs("alwaysFalse should be false") @@ -448,7 +450,7 @@ public boolean apply(@Nullable T input) { public void testSkip() { BatchingVisitable visitor = ListVisitor.create(Lists.newArrayList(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L)); ImmutableList copy = BatchingVisitableView.of(visitor).skip(5).immutableCopy(); - assertThat(copy).describedAs("unexpected list remnants after skipping").isEqualTo(ImmutableList.of(5L, 6L, 7L)); + assertThat(copy).describedAs("unexpected list remnants after skipping").containsExactly(5L, 6L, 7L); } static class ListVisitor extends AbstractBatchingVisitable { diff --git a/atlasdb-commons/src/test/java/com/palantir/remoting/HeaderAccessUtilsTest.java b/atlasdb-commons/src/test/java/com/palantir/remoting/HeaderAccessUtilsTest.java index 7b48fe8cfa3..baf5e91558a 100644 --- a/atlasdb-commons/src/test/java/com/palantir/remoting/HeaderAccessUtilsTest.java +++ b/atlasdb-commons/src/test/java/com/palantir/remoting/HeaderAccessUtilsTest.java @@ -92,7 +92,7 @@ public void caseInsensitiveGetShortcircuits() { testMap.put(KEY_2, VALUE_2); testMap.put(KEY_2.toUpperCase(), ImmutableList.of(additionalCommand)); assertThat(HeaderAccessUtils.shortcircuitingCaseInsensitiveGet(testMap, KEY_2.toUpperCase())) - .isEqualTo(VALUE_2); + .containsExactlyElementsOf(VALUE_2); } private static void assertCaseInsensitiveContainsEntry(String key, String value, boolean outcome) { diff --git a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/DbKvsPartitionersTest.java b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/DbKvsPartitionersTest.java index 69feeb4697c..5f21c46287d 100644 --- a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/DbKvsPartitionersTest.java +++ b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/DbKvsPartitionersTest.java @@ -41,12 +41,12 @@ public void testBasic() { List> partitioned = DbKvsPartitioners.partitionByTotalCount(counts, 5); assertThat(partitioned) - .isEqualTo(ImmutableList.of( + .containsExactly( ImmutableMap.of(0, 5), ImmutableMap.of( 1, 1, 2, 2, - 3, 2))); + 3, 2)); } @Test @@ -59,7 +59,7 @@ public void testKeySplitAcrossPartitions() { List> partitioned = DbKvsPartitioners.partitionByTotalCount(counts, 5); assertThat(partitioned) - .isEqualTo(ImmutableList.of( + .containsExactly( ImmutableMap.of( 0, 3, 3, 2), @@ -67,7 +67,7 @@ public void testKeySplitAcrossPartitions() { 3, 1, 1, 3, 4, 1), - ImmutableMap.of(4, 2))); + ImmutableMap.of(4, 2)); } @Test @@ -78,11 +78,11 @@ public void testKeyWithLargeCount() { List> partitioned = DbKvsPartitioners.partitionByTotalCount(counts, 5); assertThat(partitioned).hasSize(20); assertThat(partitioned.get(0)) - .isEqualTo(ImmutableMap.of( + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of( 0, 1, 1, 4)); for (int i = 1; i < 20; i++) { - assertThat(partitioned.get(i)).isEqualTo(ImmutableMap.of(1, 5)); + assertThat(partitioned.get(i)).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(1, 5)); } } @@ -121,7 +121,7 @@ private void assertTotalCountsInPartitionsMatchesOriginal( totalCountsAfterPartitioning.put(entry.getKey(), prevCount + entry.getValue()); } } - assertThat(totalCountsAfterPartitioning).isEqualTo(originalCounts); + assertThat(totalCountsAfterPartitioning).containsExactlyInAnyOrderEntriesOf(originalCounts); } private void assertOrderingInPartitionsMatchesOriginal( @@ -135,6 +135,6 @@ private void assertOrderingInPartitionsMatchesOriginal( } } } - assertThat(partitionedOrder).isEqualTo(originalOrder); + assertThat(partitionedOrder).containsExactlyElementsOf(originalOrder); } } diff --git a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/RowsColumnRangeBatchRequestsTest.java b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/RowsColumnRangeBatchRequestsTest.java index ada4b155c1a..781d8087f29 100644 --- a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/RowsColumnRangeBatchRequestsTest.java +++ b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/RowsColumnRangeBatchRequestsTest.java @@ -113,7 +113,7 @@ private static void assertRowsInPartitionsMatchOriginal( List actualAllRows = partitions.stream() .flatMap(partition -> RowsColumnRangeBatchRequests.getAllRowsInOrder(partition).stream()) .collect(Collectors.toList()); - assertThat(actualAllRows).isEqualTo(RowsColumnRangeBatchRequests.getAllRowsInOrder(original)); + assertThat(actualAllRows).containsExactlyElementsOf(RowsColumnRangeBatchRequests.getAllRowsInOrder(original)); } private static void assertColumnRangesInPartitionsMatchOriginal( diff --git a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/WhereClausesTest.java b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/WhereClausesTest.java index 0c765761928..ad812f3fa7e 100644 --- a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/WhereClausesTest.java +++ b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/WhereClausesTest.java @@ -38,7 +38,7 @@ public void startOnly() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name >= ?"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START)); } @@ -49,7 +49,7 @@ public void endOnly() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name < ?"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(END)); } @@ -63,7 +63,7 @@ public void whereClausesNoColumns() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name >= ?", "i.row_name < ?"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START, END)); } @@ -77,7 +77,7 @@ public void withReverseRange() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name <= ?", "i.row_name > ?"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(END, START)); } @@ -92,7 +92,7 @@ public void whereClausesOneColumn() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name >= ?", "i.row_name < ?", "i.col_name IN (?)"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START, END, COL1)); } @@ -107,7 +107,7 @@ public void whereClausesMultiColumn() { WhereClauses whereClauses = WhereClauses.create("i", request); List expectedClauses = ImmutableList.of("i.row_name >= ?", "i.row_name < ?", "i.col_name IN (?,?,?)"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START, END, COL1, COL2, COL3)); } @@ -122,7 +122,7 @@ public void whereClausesWithExtraClause() { WhereClauses whereClauses = WhereClauses.create("i", request, extraClause); List expectedClauses = ImmutableList.of("i.row_name >= ?", "i.row_name < ?", extraClause); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START, END)); } @@ -138,7 +138,7 @@ public void usesDifferentTableIdentifier() { List expectedClauses = ImmutableList.of("other.row_name >= ?", "other.row_name < ?", "other.col_name IN (?)"); - assertThat(expectedClauses).isEqualTo(whereClauses.getClauses()); + assertThat(expectedClauses).containsExactlyElementsOf(whereClauses.getClauses()); checkWhereArguments(whereClauses, ImmutableList.of(START, END, COL1)); } diff --git a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/sweep/CandidateGroupingIteratorTest.java b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/sweep/CandidateGroupingIteratorTest.java index e05f8b4e85e..9cb186693e3 100644 --- a/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/sweep/CandidateGroupingIteratorTest.java +++ b/atlasdb-dbkvs/src/test/java/com/palantir/atlasdb/keyvalue/dbkvs/impl/sweep/CandidateGroupingIteratorTest.java @@ -37,7 +37,7 @@ public void emptyInput() { @Test public void singleCellInOnePage() { assertThat(group(ImmutableList.of(ImmutableList.of(cellTs("a", "x", 10L), cellTs("a", "x", 20L))))) - .isEqualTo(ImmutableList.of(ImmutableList.of(candidate("a", "x", false, 10L, 20L)))); + .containsExactly(ImmutableList.of(candidate("a", "x", false, 10L, 20L))); } @Test @@ -45,30 +45,29 @@ public void singleCellSpanningTwoPages() { assertThat(group(ImmutableList.of( ImmutableList.of(cellTs("a", "x", 10L), cellTs("a", "x", 20L)), ImmutableList.of(cellTs("a", "x", 30L))))) - .isEqualTo(ImmutableList.of( - ImmutableList.of(), ImmutableList.of(candidate("a", "x", false, 10L, 20L, 30L)))); + .containsExactly(ImmutableList.of(), ImmutableList.of(candidate("a", "x", false, 10L, 20L, 30L))); } @Test public void severalCellsInSinglePage() { assertThat(group(ImmutableList.of( ImmutableList.of(cellTs("a", "x", 10L), cellTs("a", "y", 10L), cellTs("b", "y", 10L))))) - .isEqualTo(ImmutableList.of(ImmutableList.of( + .containsExactly(ImmutableList.of( candidate("a", "x", false, 10L), candidate("a", "y", false, 10L), - candidate("b", "y", false, 10L)))); + candidate("b", "y", false, 10L))); } @Test public void latestValueEmpty() { assertThat(group(ImmutableList.of(ImmutableList.of(cellTs("a", "x", 10L, false), cellTs("a", "x", 20L, true))))) - .isEqualTo(ImmutableList.of(ImmutableList.of(candidate("a", "x", true, 10L, 20L)))); + .containsExactly(ImmutableList.of(candidate("a", "x", true, 10L, 20L))); } @Test public void nonLatestValueEmpty() { assertThat(group(ImmutableList.of(ImmutableList.of(cellTs("a", "x", 10L, true), cellTs("a", "x", 20L, false))))) - .isEqualTo(ImmutableList.of(ImmutableList.of(candidate("a", "x", false, 10L, 20L)))); + .containsExactly(ImmutableList.of(candidate("a", "x", false, 10L, 20L))); } @Test diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/cleaner/KeyValueServiceScrubberStoreTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/cleaner/KeyValueServiceScrubberStoreTest.java index e74c29143a5..463d15baa65 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/cleaner/KeyValueServiceScrubberStoreTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/cleaner/KeyValueServiceScrubberStoreTest.java @@ -17,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSortedMap; @@ -62,8 +61,7 @@ public void testSingleEntryStore() { TableReference ref = TableReference.fromString("foo.bar"); long timestamp = 10; scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell, ref), timestamp, 1000); - assertThat(getScrubQueue()) - .isEqualTo(ImmutableList.of(ImmutableSortedMap.of(timestamp, ImmutableMultimap.of(ref, cell)))); + assertThat(getScrubQueue()).containsExactly(ImmutableSortedMap.of(timestamp, ImmutableMultimap.of(ref, cell))); scrubStore.markCellsAsScrubbed(ImmutableMap.of(ref, ImmutableMultimap.of(cell, timestamp)), 1000); assertThat(getScrubQueue()).isEmpty(); } @@ -80,16 +78,16 @@ public void testMultipleEntryStore() { scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell2, ref1), timestamp1, 1000); scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell3, ref2), timestamp2, 1000); assertThat(getScrubQueue()) - .isEqualTo(ImmutableList.of(ImmutableSortedMap.of( + .containsExactly(ImmutableSortedMap.of( timestamp1, ImmutableMultimap.of(ref1, cell2), - timestamp2, ImmutableMultimap.of(ref2, cell3, ref1, cell1)))); + timestamp2, ImmutableMultimap.of(ref2, cell3, ref1, cell1))); scrubStore.markCellsAsScrubbed( ImmutableMap.of( ref2, ImmutableMultimap.of(cell3, timestamp2), ref1, ImmutableMultimap.of(cell1, timestamp1, cell1, timestamp2)), 1000); assertThat(getScrubQueue()) - .isEqualTo(ImmutableList.of(ImmutableSortedMap.of(timestamp1, ImmutableMultimap.of(ref1, cell2)))); + .containsExactly(ImmutableSortedMap.of(timestamp1, ImmutableMultimap.of(ref1, cell2))); } private List>> getScrubQueue() { diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/ResilientCommitTimestampPutUnlessExistsTableTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/ResilientCommitTimestampPutUnlessExistsTableTest.java index e8c148ef0f7..4add06e79f5 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/ResilientCommitTimestampPutUnlessExistsTableTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/ResilientCommitTimestampPutUnlessExistsTableTest.java @@ -73,7 +73,7 @@ public void cannotPueTwice() { public void canPutAndGetMultiple() throws ExecutionException, InterruptedException { ImmutableMap inputs = ImmutableMap.of(1L, 2L, 3L, 4L, 7L, 8L); pueTable.putUnlessExistsMultiple(inputs); - assertThat(pueTable.get(ImmutableList.of(1L, 3L, 5L, 7L)).get()).isEqualTo(inputs); + assertThat(pueTable.get(ImmutableList.of(1L, 3L, 5L, 7L)).get()).containsExactlyInAnyOrderEntriesOf(inputs); } @Test diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/SimpleCommitTimestampPutUnlessExistsTableTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/SimpleCommitTimestampPutUnlessExistsTableTest.java index 05c48838cb6..64b84b4a5fe 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/SimpleCommitTimestampPutUnlessExistsTableTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/pue/SimpleCommitTimestampPutUnlessExistsTableTest.java @@ -73,7 +73,7 @@ public void cannotPueTwice() { public void canPutAndGetMultiple() throws ExecutionException, InterruptedException { ImmutableMap inputs = ImmutableMap.of(1L, 2L, 3L, 4L, 7L, 8L); pueTable.putUnlessExistsMultiple(inputs); - assertThat(pueTable.get(ImmutableList.of(1L, 3L, 5L, 7L)).get()).isEqualTo(inputs); + assertThat(pueTable.get(ImmutableList.of(1L, 3L, 5L, 7L)).get()).containsExactlyInAnyOrderEntriesOf(inputs); } private PutUnlessExistsTable createPueTable() { diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/SweepBatchAccumulatorTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/SweepBatchAccumulatorTest.java index 400d8f6718a..7a4f60b04fa 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/SweepBatchAccumulatorTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/SweepBatchAccumulatorTest.java @@ -94,7 +94,7 @@ public void mergesTwoBatchesWithDistinctWriteInfo() { assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); assertThat(batchWithPartitionInfo.finePartitions()) - .isEqualTo(ImmutableSet.of( + .containsExactlyInAnyOrderElementsOf(ImmutableSet.of( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 288))); } @@ -111,7 +111,7 @@ public void mergesDedicatedRows() { assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); assertThat(batchWithPartitionInfo.finePartitions()) - .isEqualTo(ImmutableSet.of( + .containsExactlyInAnyOrderElementsOf(ImmutableSet.of( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 288))); } @@ -127,7 +127,7 @@ public void mergesFinePartitionsFromWritesAndDedicatedRows() { SweepBatchWithPartitionInfo batchWithPartitionInfo = accumulator.toSweepBatch(); assertThat(batchWithPartitionInfo.finePartitions()) .hasSize(2) - .isEqualTo(ImmutableSet.of(SweepQueueUtils.tsPartitionFine(WRITE_INFO_1.timestamp()), 1L)); + .containsExactlyInAnyOrder(SweepQueueUtils.tsPartitionFine(WRITE_INFO_1.timestamp()), 1L); } @Test @@ -149,10 +149,10 @@ public void onlyKeepsNewestVersionOfWriteInfoWhenMergingMultipleBatches() { // Both must still be present here! assertThat(batchWithPartitionInfo.finePartitions()) - .isEqualTo(ImmutableSet.of( + .containsExactlyInAnyOrder( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine( - PROGRESS_TIMESTAMP + 100 + SweepQueueUtils.minTsForFinePartition(1)))); + PROGRESS_TIMESTAMP + 100 + SweepQueueUtils.minTsForFinePartition(1))); } @Test @@ -173,10 +173,10 @@ public void correctlySkipsPartitionsWhenMergingMultipleBatches() { }); assertThat(batchWithPartitionInfo.finePartitions()) - .isEqualTo(ImmutableSet.of( + .containsExactlyInAnyOrder( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine( - PROGRESS_TIMESTAMP + 100 + SweepQueueUtils.minTsForFinePartition(9)))); + PROGRESS_TIMESTAMP + 100 + SweepQueueUtils.minTsForFinePartition(9))); } @Test diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/WriteInfoPartitionerTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/WriteInfoPartitionerTest.java index 0cd5cc8f8e0..f6d87b7837c 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/WriteInfoPartitionerTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/sweep/queue/WriteInfoPartitionerTest.java @@ -148,7 +148,7 @@ public void partitionWritesByShardStrategyTimestampGroupsOnShardClash() { Map> partitions = partitioner.partitionWritesByShardStrategyTimestamp(writes); assertThat(partitions.keySet()) .containsExactly(PartitionInfo.of(writes.get(0).toShard(numShards), true, 1L)); - assertThat(Iterables.getOnlyElement(partitions.values())).isEqualTo(writes); + assertThat(Iterables.getOnlyElement(partitions.values())).containsExactlyElementsOf(writes); } @Test diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/service/SplitKeyDelegatingTransactionServiceTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/service/SplitKeyDelegatingTransactionServiceTest.java index 1207c625fde..43760be0afe 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/service/SplitKeyDelegatingTransactionServiceTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/service/SplitKeyDelegatingTransactionServiceTest.java @@ -109,7 +109,8 @@ public void putUnlessExistsThrowsIfFunctionReturnsUnmappedValue() { @Test public void getMultipleDelegatesRequestsToGetMultipleOnDelegates() { when(delegate1.get(any())).thenReturn(ImmutableMap.of(1L, 2L)); - assertThat(delegatingTransactionService.get(ImmutableList.of(1L))).isEqualTo(ImmutableMap.of(1L, 2L)); + assertThat(delegatingTransactionService.get(ImmutableList.of(1L))) + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(1L, 2L)); verifyDelegateHadMultigetCalledWith(delegate1, 1L); } @@ -118,7 +119,7 @@ public void getMultiplePartitionsRequestsAndMergesMaps() { when(delegate1.get(any())).thenReturn(ImmutableMap.of(1L, 8L, 41L, 48L)); when(delegate2.get(any())).thenReturn(ImmutableMap.of(12L, 28L, 32L, 38L)); assertThat(delegatingTransactionService.get(ImmutableList.of(1L, 12L, 32L, 41L))) - .isEqualTo(ImmutableMap.of(1L, 8L, 12L, 28L, 32L, 38L, 41L, 48L)); + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(1L, 8L, 12L, 28L, 32L, 38L, 41L, 48L)); verifyDelegateHadMultigetCalledWith(delegate1, 1L, 41L); verifyDelegateHadMultigetCalledWith(delegate2, 12L, 32L); } @@ -143,7 +144,7 @@ public void ignoreUnknownIgnoresUnknownTimestampServicesForMultipleTimestamps() when(delegate1.get(any())).thenReturn(ImmutableMap.of(1L, 8L, 41L, 48L)); assertThat(lastDigitFiveImpliesUnknownTransactionService.get(ImmutableList.of(1L, 5L, 35L, 41L))) - .isEqualTo(ImmutableMap.of(1L, 8L, 41L, 48L)); + .containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(1L, 8L, 41L, 48L)); verifyDelegateHadMultigetCalledWith(delegate1, 1L, 41L); } diff --git a/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/JepsenHistoryCheckerTest.java b/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/JepsenHistoryCheckerTest.java index d5e787cb6f1..87e7743de93 100644 --- a/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/JepsenHistoryCheckerTest.java +++ b/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/JepsenHistoryCheckerTest.java @@ -60,7 +60,7 @@ public void correctHistoryShouldReturnValidAndNoErrors() { Map expectedResults = ImmutableMap.of(Keyword.intern("valid?"), true, Keyword.intern("errors"), ImmutableList.of()); - assertThat(results).isEqualTo(expectedResults); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expectedResults); } @Test @@ -71,7 +71,7 @@ public void incorrectHistoryShouldReturnInvalidWithErrors() { Map expectedResults = ImmutableMap.of( Keyword.intern("valid?"), false, Keyword.intern("errors"), ImmutableList.of(INFO_EVENT)); - assertThat(results).isEqualTo(expectedResults); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expectedResults); } @Test @@ -83,7 +83,7 @@ public void ifTwoCheckersFailErrorsAreCombined() { Map expectedResults = ImmutableMap.of( Keyword.intern("valid?"), false, Keyword.intern("errors"), ImmutableList.of(INFO_EVENT, INVOKE_EVENT)); - assertThat(results).isEqualTo(expectedResults); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expectedResults); } @Test @@ -95,7 +95,7 @@ public void invalidIfOneOutOfTwoCheckersFails() { Map expectedResults = ImmutableMap.of( Keyword.intern("valid?"), false, Keyword.intern("errors"), ImmutableList.of(INFO_EVENT)); - assertThat(results).isEqualTo(expectedResults); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expectedResults); } @Test diff --git a/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/events/EventTest.java b/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/events/EventTest.java index 13b617cfcff..8bc7a3c8351 100644 --- a/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/events/EventTest.java +++ b/atlasdb-jepsen-tests/src/test/java/com/palantir/atlasdb/jepsen/events/EventTest.java @@ -246,7 +246,7 @@ public void canSerialiseInfoEventWithValue() { Keyword.intern("time"), SOME_TIME, Keyword.intern("value"), "bar"); - assertThat(Event.toKeywordMap(infoEvent)).isEqualTo(expected); + assertThat(Event.toKeywordMap(infoEvent)).containsExactlyInAnyOrderEntriesOf(expected); } @Test @@ -267,6 +267,6 @@ public void canSerialiseInfoEventWithoutValue() { Keyword.intern("time"), SOME_TIME); - assertThat(Event.toKeywordMap(infoEvent)).isEqualTo(expected); + assertThat(Event.toKeywordMap(infoEvent)).containsExactlyInAnyOrderEntriesOf(expected); } } diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractGetCandidateCellsForSweepingTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractGetCandidateCellsForSweepingTest.java index e766be2c3b3..432a3573bbb 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractGetCandidateCellsForSweepingTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractGetCandidateCellsForSweepingTest.java @@ -69,11 +69,11 @@ public void singleCellSpanningSeveralPages() { List cells = getAllCandidates(conservativeRequest(PtBytes.EMPTY_BYTE_ARRAY, 2000L, 2)); assertThat(cells) - .isEqualTo(ImmutableList.of(ImmutableCandidateCellForSweeping.builder() + .containsExactly(ImmutableCandidateCellForSweeping.builder() .cell(cell(10, 1)) .isLatestValueEmpty(false) .sortedTimestamps(ImmutableList.of(1000L, 1001L, 1002L, 1003L, 1004L)) - .build())); + .build()); } @Test @@ -221,7 +221,7 @@ private void doTestLargerTable(boolean checkIfLatestValueIsEmpty) { .batchSizeHint(1) .build()); assertThat(candidates.stream().map(CandidateCellForSweeping::cell).collect(Collectors.toList())) - .isEqualTo(expectedCells); + .containsExactlyElementsOf(expectedCells); } protected List getAllCandidates(CandidateCellForSweepingRequest request) { diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractKeyValueServiceTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractKeyValueServiceTest.java index 589cd248015..3564bb0b9af 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractKeyValueServiceTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/keyvalue/impl/AbstractKeyValueServiceTest.java @@ -821,9 +821,9 @@ private void doTestGetRangePaging(int numColumnsInMetadata, int batchSizeHint, b .build())); if (reverse) { - assertThat(results).isEqualTo(Lists.reverse(expected)); + assertThat(results).containsExactlyElementsOf(Lists.reverse(expected)); } else { - assertThat(results).isEqualTo(expected); + assertThat(results).containsExactlyElementsOf(expected); } } } @@ -856,7 +856,7 @@ private void doTestGetRangePagingLastRowEdgeCase(int numColumnsInMetadata, int b .put(PtBytes.toBytes("c1"), Value.create(PtBytes.toBytes("a"), TEST_TIMESTAMP)) .put(last, Value.create(PtBytes.toBytes("b"), TEST_TIMESTAMP)) .build())); - assertThat(results).isEqualTo(expected); + assertThat(results).containsExactlyElementsOf(expected); } } @@ -913,7 +913,7 @@ private void doTestGetRangePagingWithColumnSelection( keyValueService.getRange(TEST_TABLE, request, TEST_TIMESTAMP + 1)) { List> results = ImmutableList.copyOf(iter); assertThat(results) - .isEqualTo(getExpectedResultForRangePagingWithColumnSelectionTest( + .containsExactlyElementsOf(getExpectedResultForRangePagingWithColumnSelectionTest( numRows, numColsInSelection, reverse)); } } diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTaskRunnerTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTaskRunnerTest.java index 9d87054fb9c..6fd00ba683d 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTaskRunnerTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTaskRunnerTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; import com.palantir.atlasdb.encoding.PtBytes; @@ -87,7 +86,7 @@ public void testSweepStrategyNothing() { PtBytes.EMPTY_BYTE_ARRAY, SweepTaskRunner.RunType.FULL); assertThat(results).isEqualTo(SweepResults.createEmptySweepResult(Optional.empty())); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(50L, 75L, 100L, 125L, 150L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(50L, 75L, 100L, 125L, 150L); } @Test(timeout = 50000) @@ -117,7 +116,7 @@ public void testSweepBatchesUpToDeleteBatchSize() { List> sweptCells = sweptCellsAndSweepResults.getLhSide(); assertThat(sweptCells).hasSize(1); - assertThat(sweptCells.get(0)).isEqualTo(SMALL_LIST_OF_CELLS); + assertThat(sweptCells.get(0)).containsExactlyElementsOf(SMALL_LIST_OF_CELLS); } @Test(timeout = 50000) @@ -181,7 +180,7 @@ public void testSweepUncommittedConservative() { assertThat(results.getStaleValuesDeleted()).isEqualTo(1); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(2); assertThat(getFromDefaultColumn("foo", 750)).isEqualTo("bar"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(50L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(50L); } @Test(timeout = 50000) @@ -197,7 +196,7 @@ public void testSweepManyValuesThorough() { assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(5); assertThat(getFromDefaultColumn("foo", 200)).isEqualTo("buzz"); assertThat(getFromDefaultColumn("foo", 124)).isNull(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(125L); } @Test(timeout = 50000) @@ -213,7 +212,7 @@ public void testSweepManyValuesIncludingUncommittedConservative() { assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(5); assertThat(getFromDefaultColumn("foo", 200)).isEqualTo("buzz"); assertThat(getFromDefaultColumn("foo", 124)).isEmpty(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(-1L, 125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(-1L, 125L); } @Test(timeout = 50000) @@ -225,7 +224,7 @@ public void testSweepUncommittedThorough() { assertThat(results.getStaleValuesDeleted()).isEqualTo(1); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(2); assertThat(getFromDefaultColumn("foo", 750)).isEqualTo("bar"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(50L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(50L); } @Test(timeout = 50000) @@ -268,7 +267,7 @@ public void testSweepManyLatestDeletedThoroughIncludingUncommitted1() { // but we don't delete it on the first pass due to the later uncommitted value. below we sweep again and make // sure it's deleted assertThat(getFromDefaultColumn("foo", 200)).isEmpty(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(125L); results = completeSweep(175).get(); assertThat(results.getStaleValuesDeleted()).isEqualTo(1); @@ -289,7 +288,7 @@ public void testSweepManyLatestDeletedThoroughIncludingUncommitted2() { assertThat(results.getStaleValuesDeleted()).isEqualTo(4); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(5); assertThat(getFromDefaultColumn("foo", 200)).isEqualTo("foo"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(125L); } @Test diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTest.java index 5e36feb2a95..03fb557a70c 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/AbstractSweepTest.java @@ -120,7 +120,7 @@ public void testSweepOneConservative() { assertThat(getFromDefaultColumn("foo", 150)).isEqualTo("baz"); assertThat(getFromDefaultColumn("foo", 80)).isEmpty(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(-1L, 100L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(-1L, 100L); } @Test(timeout = 50000) @@ -153,7 +153,7 @@ public void testSweepManyValuesConservative() { assertThat(getFromDefaultColumn("foo", 200)).isEqualTo("buzz"); assertThat(getFromDefaultColumn("foo", 124)).isEmpty(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(-1L, 125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(-1L, 125L); } @Test(timeout = 50000) @@ -177,7 +177,7 @@ public void testDontSweepFutureConservative() { assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(3); }); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(-1L, 100L, 125L, 150L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(-1L, 100L, 125L, 150L); } @Test(timeout = 50000) @@ -194,7 +194,7 @@ public void testSweepOneThorough() { assertThat(getFromDefaultColumn("foo", 150)).isEqualTo("baz"); assertThat(getFromDefaultColumn("foo", 80)).isNull(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(100L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(100L); } @Test(timeout = 50000) @@ -209,7 +209,7 @@ public void testDontSweepLatestThorough() { }); assertThat(getFromDefaultColumn("foo", 150)).isEqualTo("bar"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(50L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(50L); } @Test(timeout = 50000) @@ -246,7 +246,7 @@ public void testSweepLatestDeletedMultiColThorough() { // The other column was unaffected assertThat(get("foo", "other column", 150)).isEqualTo("other value"); - assertThat(getAllTs("foo", "other column")).isEqualTo(ImmutableSet.of(40L)); + assertThat(getAllTs("foo", "other column")).containsExactlyInAnyOrder(40L); } @Test(timeout = 50000) @@ -262,7 +262,7 @@ public void testSweepLatestDeletedMultiValConservative() { }); assertThat(getFromDefaultColumn("foo", 150)).isEmpty(); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(-1L, 50L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(-1L, 50L); } @Test(timeout = 50000) @@ -278,7 +278,7 @@ public void testSweepLatestNotDeletedMultiValThorough() { }); assertThat(getFromDefaultColumn("foo", 150)).isEqualTo("new value"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(50L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(50L); } @Test(timeout = 50000) @@ -356,7 +356,7 @@ public void testSweepManyLatestDeletedThorough2() { }); assertThat(getFromDefaultColumn("foo", 200)).isEqualTo("foo"); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(125L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(125L); } @Test(timeout = 50000) @@ -375,7 +375,7 @@ public void testDontSweepFutureThorough() { assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(3); }); - assertThat(getAllTsFromDefaultColumn("foo")).isEqualTo(ImmutableSet.of(100L, 125L, 150L)); + assertThat(getAllTsFromDefaultColumn("foo")).containsExactlyInAnyOrder(100L, 125L, 150L); } @Test(timeout = 50000) @@ -413,9 +413,10 @@ public void testSweepOnMixedCaseTable() { void assertEqualsDisregardingExtraSentinels(Set expectedTimestamps, Set actualTimestamps) { if (expectedTimestamps.contains(-1L)) { - assertThat(actualTimestamps).isEqualTo(expectedTimestamps); + assertThat(actualTimestamps).containsExactlyInAnyOrderElementsOf(expectedTimestamps); } else { - assertThat(Sets.difference(actualTimestamps, ImmutableSet.of(-1L))).isEqualTo(expectedTimestamps); + assertThat(Sets.difference(actualTimestamps, ImmutableSet.of(-1L))) + .containsExactlyInAnyOrderElementsOf(expectedTimestamps); } } diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractTransactionTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractTransactionTest.java index 4fb20ba7e1f..aef1a09b56d 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractTransactionTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractTransactionTest.java @@ -1862,9 +1862,10 @@ private void verifyAllGetRangesImplsNumRanges( Iterable>> getRangesLazyImpl = t.getRangesLazy(TEST_TABLE, rangeRequests).collect(Collectors.toList()); - assertThat(extractStringsFromVisitables(getRangesWithPrefetchingImpl)).isEqualTo(expectedValues); - assertThat(extractStringsFromVisitables(getRangesInParallelImpl)).isEqualTo(expectedValues); - assertThat(extractStringsFromVisitables(getRangesLazyImpl)).isEqualTo(expectedValues); + assertThat(extractStringsFromVisitables(getRangesWithPrefetchingImpl)) + .containsExactlyElementsOf(expectedValues); + assertThat(extractStringsFromVisitables(getRangesInParallelImpl)).containsExactlyElementsOf(expectedValues); + assertThat(extractStringsFromVisitables(getRangesLazyImpl)).containsExactlyElementsOf(expectedValues); } private List extractStringsFromVisitables(Iterable>> visitables) { diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/ptobject/EncodingUtilsTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/ptobject/EncodingUtilsTest.java index 14703dce17d..c3d594defe3 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/ptobject/EncodingUtilsTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/ptobject/EncodingUtilsTest.java @@ -298,7 +298,7 @@ public void testMulti() { List result = EncodingUtils.fromBytes(b, types); - assertThat(result).isEqualTo(components); + assertThat(result).containsExactlyElementsOf(components); } } } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/sweep/priority/SweepPriorityStoreTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/sweep/priority/SweepPriorityStoreTest.java index 5111d7060bf..905a453b54c 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/sweep/priority/SweepPriorityStoreTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/sweep/priority/SweepPriorityStoreTest.java @@ -73,7 +73,7 @@ public void testStoreAndLoadNew() throws Exception { return null; }); assertThat(ImmutableSet.copyOf(txManager.runTaskReadOnly(priorityStore::loadNewPriorities))) - .isEqualTo(ImmutableSet.of(priority("foo.bar", 0), priority("qwe.rty", 1))); + .containsExactlyInAnyOrder(priority("foo.bar", 0), priority("qwe.rty", 1)); } @Test @@ -86,8 +86,7 @@ public void testUpdateAndLoad() { priorityStore.update(tx, TableReference.createFromFullyQualifiedName("foo.bar"), fullUpdate(1)); return null; }); - assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)) - .isEqualTo(ImmutableList.of(priority("foo.bar", 1))); + assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)).containsExactly(priority("foo.bar", 1)); // TODO(gbonik): This currently fails because the getTimestamp override hack never worked. // We should create a ticket to track this. // Assert.assertEquals( @@ -108,8 +107,7 @@ public void testDelete() throws Exception { priorityStore.delete(tx, ImmutableList.of(TableReference.createFromFullyQualifiedName("foo.bar"))); return null; }); - assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)) - .isEqualTo(ImmutableList.of(priority("qwe.rty", 1))); + assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)).containsExactly(priority("qwe.rty", 1)); } @Test @@ -128,14 +126,14 @@ public void testPartialUpdate() { return null; }); assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)) - .isEqualTo(ImmutableList.of(ImmutableSweepPriority.builder() + .containsExactly(ImmutableSweepPriority.builder() .tableRef(TableReference.createFromFullyQualifiedName("foo.bar")) .staleValuesDeleted(555) .cellTsPairsExamined(10) .lastSweepTimeMillis(123) .minimumSweptTimestamp(456) .writeCount(5) - .build())); + .build()); } @Test @@ -150,14 +148,14 @@ public void testLoadDefaultsIfFieldMissing() { return null; }); assertThat(txManager.runTaskReadOnly(priorityStore::loadNewPriorities)) - .isEqualTo(ImmutableList.of(ImmutableSweepPriority.builder() + .containsExactly(ImmutableSweepPriority.builder() .tableRef(TableReference.createFromFullyQualifiedName("foo.bar")) .staleValuesDeleted(1) .cellTsPairsExamined(0) .lastSweepTimeMillis(OptionalLong.empty()) .minimumSweptTimestamp(Long.MIN_VALUE) .writeCount(0) - .build())); + .build()); } private static UpdateSweepPriority fullUpdate(int increment) { diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/CachingTransactionTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/CachingTransactionTest.java index 0d7d0e349e7..962e847b438 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/CachingTransactionTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/CachingTransactionTest.java @@ -100,8 +100,10 @@ public void testCacheEmptyGets() { } }); - assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).isEqualTo(emptyResults); - assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).isEqualTo(emptyResults); + assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)) + .containsExactlyInAnyOrderEntriesOf(emptyResults); + assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)) + .containsExactlyInAnyOrderEntriesOf(emptyResults); mockery.assertIsSatisfied(); } @@ -136,8 +138,8 @@ public void testGetRows() { } }); - assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).isEqualTo(oneResult); - assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).isEqualTo(oneResult); + assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).containsExactlyInAnyOrderEntriesOf(oneResult); + assertThat(cachingTransaction.getRows(table, oneRow, oneColumn)).containsExactlyInAnyOrderEntriesOf(oneResult); mockery.assertIsSatisfied(); } @@ -165,8 +167,8 @@ private void testGetCellResults(Cell cell, Map cellValueMap) { final Set cellSet = ImmutableSet.of(cell); mockery.checking(expectationsMapping.get(name).apply(cellSet, cellValueMap)); - assertThat(cachingTransaction.get(table, cellSet)).isEqualTo(cellValueMap); - assertThat(cachingTransaction.get(table, cellSet)).isEqualTo(cellValueMap); + assertThat(cachingTransaction.get(table, cellSet)).containsExactlyInAnyOrderEntriesOf(cellValueMap); + assertThat(cachingTransaction.get(table, cellSet)).containsExactlyInAnyOrderEntriesOf(cellValueMap); mockery.assertIsSatisfied(); } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java index 8ad60d7b965..002690b1a4a 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionTest.java @@ -1107,7 +1107,7 @@ public void cleanup() {} .get(row)) .transform(Map.Entry::getKey) .immutableCopy()); - assertThat(cells).isEqualTo(ImmutableList.of(firstCell, secondCell)); + assertThat(cells).containsExactly(firstCell, secondCell); } @Test @@ -1144,7 +1144,7 @@ public void cleanup() {} Lists.newArrayList( tx.getRowsColumnRange(TABLE, ImmutableList.of(row), new ColumnRangeSelection(null, null), 10)), Map.Entry::getKey)); - assertThat(cells).isEqualTo(ImmutableList.of(firstCell, secondCell)); + assertThat(cells).containsExactly(firstCell, secondCell); } @Test @@ -1199,7 +1199,7 @@ private void runTestForGetRowsColumnRangeSingleIteratorVersion( (Cell cell) -> ByteBuffer.wrap(cell.getRowName()), Ordering.explicit(Lists.transform(shuffledRows, ByteBuffer::wrap))) .thenComparing(Cell::getColumnName, PtBytes.BYTES_COMPARATOR)); - Assertions.assertThat(cells).isEqualTo(expectedCells); + Assertions.assertThat(cells).containsExactlyElementsOf(expectedCells); keyValueService.truncateTable(TABLE); } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/service/ReadOnlyTransactionServiceIntegrationTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/service/ReadOnlyTransactionServiceIntegrationTest.java index 0376904ed8d..2d592a981ad 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/service/ReadOnlyTransactionServiceIntegrationTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/service/ReadOnlyTransactionServiceIntegrationTest.java @@ -71,6 +71,7 @@ public void canReadMultipleAgreedValuesEvenAfterAdditionalCoordinations() { assertThat(readOnlyTransactionService.get( ImmutableList.of(1L, COORDINATION_QUANTUM + 1L, 2 * COORDINATION_QUANTUM + 1L))) - .isEqualTo(ImmutableMap.of(1L, 8L, COORDINATION_QUANTUM + 1L, COORDINATION_QUANTUM + 5L)); + .containsExactlyInAnyOrderEntriesOf( + ImmutableMap.of(1L, 8L, COORDINATION_QUANTUM + 1L, COORDINATION_QUANTUM + 5L)); } } diff --git a/commons-executors/src/test/java/com/palantir/common/concurrent/ExecutorInheritableThreadLocalTest.java b/commons-executors/src/test/java/com/palantir/common/concurrent/ExecutorInheritableThreadLocalTest.java index eaf2dab7622..dccaabeed2a 100644 --- a/commons-executors/src/test/java/com/palantir/common/concurrent/ExecutorInheritableThreadLocalTest.java +++ b/commons-executors/src/test/java/com/palantir/common/concurrent/ExecutorInheritableThreadLocalTest.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Callables; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; @@ -157,7 +156,7 @@ public void testChild() throws InterruptedException, ExecutionException { return null; }); future.get(); - assertThat(outputList).isEqualTo(ImmutableList.of(11, 12)); + assertThat(outputList).containsExactly(11, 12); } @Test diff --git a/examples/profile-client/src/test/java/com/palantir/example/profile/ProfileStoreTest.java b/examples/profile-client/src/test/java/com/palantir/example/profile/ProfileStoreTest.java index bfa71d75579..ca9dd51f1fa 100644 --- a/examples/profile-client/src/test/java/com/palantir/example/profile/ProfileStoreTest.java +++ b/examples/profile-client/src/test/java/com/palantir/example/profile/ProfileStoreTest.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import com.google.common.collect.ImmutableSet; import com.palantir.atlasdb.factory.InMemoryLockAndTimestampServiceFactory; import com.palantir.atlasdb.factory.TransactionManagers; import com.palantir.atlasdb.transaction.api.Transaction; @@ -154,7 +153,7 @@ public void testBirthdayIndex() { final UUID userId = storeUser(); runWithRetry(store -> { Set usersWithBirthday = store.getUsersWithBirthday(USER.getBirthEpochDay()); - assertThat(usersWithBirthday).isEqualTo(ImmutableSet.of(userId)); + assertThat(usersWithBirthday).containsExactlyInAnyOrder(userId); return userId; }); } diff --git a/leader-election-impl/src/test/java/com/palantir/paxos/PaxosStateLogBatchReaderTest.java b/leader-election-impl/src/test/java/com/palantir/paxos/PaxosStateLogBatchReaderTest.java index 332e7b597b4..96ec4df5a8b 100644 --- a/leader-election-impl/src/test/java/com/palantir/paxos/PaxosStateLogBatchReaderTest.java +++ b/leader-election-impl/src/test/java/com/palantir/paxos/PaxosStateLogBatchReaderTest.java @@ -48,7 +48,7 @@ public void readConsecutiveBatch() throws IOException { .persistToBytes()); try (PaxosStateLogBatchReader reader = createReader()) { - assertThat(reader.readBatch(START_SEQUENCE, BATCH_SIZE)).isEqualTo(EXPECTED_ROUNDS); + assertThat(reader.readBatch(START_SEQUENCE, BATCH_SIZE)).containsExactlyElementsOf(EXPECTED_ROUNDS); } } @@ -82,7 +82,7 @@ public void readBatchFiltersOutNulls() throws IOException { try (PaxosStateLogBatchReader reader = createReader()) { assertThat(reader.readBatch(START_SEQUENCE, BATCH_SIZE)) - .isEqualTo(EXPECTED_ROUNDS.stream() + .containsExactlyElementsOf(EXPECTED_ROUNDS.stream() .filter(round -> isOdd.test(round.sequence())) .collect(Collectors.toList())); } diff --git a/lock-api/src/test/java/com/palantir/lock/client/MultiClientCommitTimestampGetterTest.java b/lock-api/src/test/java/com/palantir/lock/client/MultiClientCommitTimestampGetterTest.java index 3c005c8fe2b..3d66139a3d6 100644 --- a/lock-api/src/test/java/com/palantir/lock/client/MultiClientCommitTimestampGetterTest.java +++ b/lock-api/src/test/java/com/palantir/lock/client/MultiClientCommitTimestampGetterTest.java @@ -169,7 +169,7 @@ private void assertSanityOfResponse( elem -> elem.argument().namespace(), Collectors.mapping(elem -> Futures.getUnchecked(elem.result()), toList()))); - assertThat(partitionedResponseMap.keySet()).isEqualTo(expectedResponseMap.keySet()); + assertThat(partitionedResponseMap.keySet()).containsExactlyInAnyOrderElementsOf(expectedResponseMap.keySet()); assertCorrectnessOfCompletedRequests(expectedResponseMap, partitionedResponseMap); } diff --git a/lock-impl/src/test/java/com/palantir/lock/LockServiceTest.java b/lock-impl/src/test/java/com/palantir/lock/LockServiceTest.java index 14504b1fe69..db136455be7 100644 --- a/lock-impl/src/test/java/com/palantir/lock/LockServiceTest.java +++ b/lock-impl/src/test/java/com/palantir/lock/LockServiceTest.java @@ -123,7 +123,7 @@ public void testDoNotBlock() throws InterruptedException { assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(this.client); assertThat(token1.getVersionId()).isEqualTo(10); - assertThat(token1.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); assertThat(token1.getExpirationDateMs()) .isBetween(currentTimeMs + lockTimeoutMs, System.currentTimeMillis() + lockTimeoutMs); @@ -169,16 +169,16 @@ public void testDoNotBlock() throws InterruptedException { .getToken(); assertThat(token3).isNotNull(); - assertThat(server.getTokens(this.client)).isEqualTo(ImmutableSet.of(token1, token2, token3)); + assertThat(server.getTokens(this.client)).containsExactlyInAnyOrder(token1, token2, token3); assertThat(server.getMinLockedInVersionId(this.client).longValue()).isEqualTo(5); server.unlock(token2); - assertThat(server.getTokens(this.client)).isEqualTo(ImmutableSet.of(token1, token3)); + assertThat(server.getTokens(this.client)).containsExactlyInAnyOrder(token1, token3); assertThat(server.getMinLockedInVersionId(this.client).longValue()).isEqualTo(10); server.unlock(token1); assertThat(server.refreshTokens(ImmutableSet.of(token1, token2, token3))) - .isEqualTo(ImmutableSet.of(token3)); + .containsExactlyInAnyOrder(token3); assertThat(server.getMinLockedInVersionId(this.client)).isNull(); server.unlock(token3); @@ -203,7 +203,7 @@ public void testBlockForAtMost() throws Exception { HeldLocksToken token1 = response.getToken(); assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(client); - assertThat(token1.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); assertThat(token1.getExpirationDateMs()) .isBetween(currentTimeMs + lockTimeoutMs, System.currentTimeMillis() + lockTimeoutMs); @@ -214,7 +214,9 @@ public void testBlockForAtMost() throws Exception { .blockForAtMost(SimpleTimeDuration.of(10, TimeUnit.MILLISECONDS)) .build()); assertThat(response1.success()).isFalse(); - assertThat(response1.getLockHolders()).isNotEmpty().isEqualTo(ImmutableSortedMap.of(lock2, client)); + assertThat(response1.getLockHolders()) + .isNotEmpty() + .containsExactlyInAnyOrderEntriesOf(ImmutableSortedMap.of(lock2, client)); assertThat(response1.getToken()).isNull(); barrier.await(); @@ -270,18 +272,18 @@ public void testBlockForAtMost() throws Exception { HeldLocksToken token3 = response.getToken(); assertThat(token3).isNotNull(); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token1, token2, token3)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token1, token2, token3); assertThat(server.getMinLockedInVersionId(client).longValue()).isEqualTo(5); assertThat(server.getMinLockedInVersionId(LockClient.ANONYMOUS)).isNull(); server.unlock(token2); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token1, token3)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token1, token3); assertThat(server.getMinLockedInVersionId(client).longValue()).isEqualTo(10); assertThat(server.getMinLockedInVersionId(LockClient.ANONYMOUS)).isNull(); server.unlock(token1); assertThat(server.refreshTokens(ImmutableSet.of(token1, token2, token3))) - .isEqualTo(ImmutableSet.of(token3)); + .containsExactlyInAnyOrder(token3); assertThat(server.getMinLockedInVersionId(client)).isNull(); server.unlock(token3); @@ -305,7 +307,7 @@ public void testBlockIndefinitely() throws Exception { HeldLocksToken token1 = response.getToken(); assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(client); - assertThat(token1.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); assertThat(token1.getExpirationDateMs()) .isBetween(currentTimeMs + lockTimeoutMs, System.currentTimeMillis() + lockTimeoutMs); @@ -351,18 +353,18 @@ public void testBlockIndefinitely() throws Exception { .getToken(); assertThat(token3).isNotNull(); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token1, token2, token3)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token1, token2, token3); assertThat(server.getMinLockedInVersionId(client).longValue()).isEqualTo(5); assertThat(server.getMinLockedInVersionId(LockClient.ANONYMOUS)).isNull(); server.unlock(token2); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token1, token3)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token1, token3); assertThat(server.getMinLockedInVersionId(client).longValue()).isEqualTo(10); assertThat(server.getMinLockedInVersionId(LockClient.ANONYMOUS)).isNull(); server.unlock(token1); assertThat(server.refreshTokens(ImmutableSet.of(token1, token2, token3))) - .isEqualTo(ImmutableSet.of(token3)); + .containsExactlyInAnyOrder(token3); assertThat(server.getMinLockedInVersionId(client)).isNull(); server.unlock(token3); @@ -456,14 +458,14 @@ public void testLockAsManyAsPossible() throws InterruptedException { HeldLocksToken token1 = response.getToken(); assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(client); - assertThat(token1.getLockDescriptors()).isEqualTo(request1.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request1.getLockDescriptors()); response = server.lockWithFullLockResponse(LockClient.ANONYMOUS, request2); HeldLocksToken token2 = response.getToken(); System.out.println(response.getLockHolders()); assertThat(token2).isNotNull(); assertThat(token2.getClient()).isEqualTo(LockClient.ANONYMOUS); - assertThat(token2.getLockDescriptors()).isEqualTo(request2.getLockDescriptors()); + assertThat(token2.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request2.getLockDescriptors()); LockRequest request3 = LockRequest.builder(ImmutableSortedMap.of(lock1, LockMode.READ, lock2, LockMode.WRITE)) .lockAsManyAsPossible() @@ -475,7 +477,7 @@ public void testLockAsManyAsPossible() throws InterruptedException { assertThat(token3).isNotNull(); assertThat(token3.getClient()).isEqualTo(client); assertThat(token3.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ))); server.unlock(token1); server.unlock(token2); @@ -503,7 +505,7 @@ public void testLogCurrentState() throws Exception { HeldLocksToken token1 = response1.getToken(); assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(LockClient.ANONYMOUS); - assertThat(token1.getLockDescriptors()).isEqualTo(request1.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request1.getLockDescriptors()); assertThat(token1.getExpirationDateMs()) .isBetween(currentTimeMs + lockTimeoutMs, System.currentTimeMillis() + lockTimeoutMs); @@ -556,7 +558,7 @@ public void testGetLockState() throws Exception { assertThat(response1.success()).isTrue(); LockState state1 = server.getLockState(lock1); assertThat(state1.isWriteLocked()).isFalse(); - assertThat(ImmutableList.of(LockClient.ANONYMOUS)).isEqualTo(state1.exactCurrentLockHolders()); + assertThat(ImmutableList.of(LockClient.ANONYMOUS)).containsExactlyElementsOf(state1.exactCurrentLockHolders()); assertThat(Thread.currentThread().getName()) .isEqualTo(Iterables.getOnlyElement(state1.holders()).requestingThread()); @@ -630,11 +632,11 @@ public void testLockReponse() throws InterruptedException { response = server.lockWithFullLockResponse(LockClient.ANONYMOUS, request); assertThat(response.success()).isTrue(); assertThat(response.getLockHolders().isEmpty()).isFalse(); - assertThat(response.getLockHolders()).isEqualTo(ImmutableMap.of(lock3, client)); + assertThat(response.getLockHolders()).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(lock3, client)); HeldLocksToken token = response.getToken(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); assertThat(token.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ))); request = LockRequest.builder(ImmutableSortedMap.of(lock2, LockMode.READ, lock4, LockMode.WRITE)) .lockAsManyAsPossible() @@ -643,11 +645,11 @@ public void testLockReponse() throws InterruptedException { response = server.lockWithFullLockResponse(LockClient.ANONYMOUS, request); assertThat(response.success()).isTrue(); assertThat(response.getLockHolders().isEmpty()).isFalse(); - assertThat(response.getLockHolders()).isEqualTo(ImmutableMap.of(lock4, client)); + assertThat(response.getLockHolders()).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(lock4, client)); token = response.getToken(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); assertThat(token.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock2, LockMode.READ))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock2, LockMode.READ))); request = LockRequest.builder(ImmutableSortedMap.of(lock1, LockMode.READ, lock2, LockMode.READ)) .lockAsManyAsPossible() @@ -659,7 +661,8 @@ public void testLockReponse() throws InterruptedException { token = response.getToken(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); assertThat(token.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ, lock2, LockMode.READ))); + .containsExactlyInAnyOrderElementsOf( + LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.READ, lock2, LockMode.READ))); request = LockRequest.builder(ImmutableSortedMap.of(lock3, LockMode.WRITE, lock4, LockMode.WRITE)) .lockAsManyAsPossible() @@ -668,7 +671,8 @@ public void testLockReponse() throws InterruptedException { response = server.lockWithFullLockResponse(LockClient.ANONYMOUS, request); assertThat(response.success()).isFalse(); assertThat(response.getLockHolders().isEmpty()).isFalse(); - assertThat(response.getLockHolders()).isEqualTo(ImmutableSortedMap.of(lock3, client, lock4, client)); + assertThat(response.getLockHolders()) + .containsExactlyInAnyOrderEntriesOf(ImmutableSortedMap.of(lock3, client, lock4, client)); token = response.getToken(); assertThat(token).isNull(); } @@ -710,7 +714,7 @@ public void testGrants() throws Exception { LockClient client2 = LockClient.of("client2"); LockResponse response = server.lockWithFullLockResponse(client2, requestWrite); assertThat(response.success()).isFalse(); - assertThat(response.getLockHolders()).isEqualTo(ImmutableMap.of(lock1, client)); + assertThat(response.getLockHolders()).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of(lock1, client)); HeldLocksToken nullToken = response.getToken(); assertThat(nullToken).isNull(); @@ -814,7 +818,7 @@ public void testIllegalActions() throws InterruptedException { .getToken(); assertThat(token).isNotNull(); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token); assertThatThrownBy(() -> server.getTokens(LockClient.ANONYMOUS)) .describedAs("Expected: can't refresh an anonymous client") .isInstanceOf(IllegalArgumentException.class); @@ -853,7 +857,7 @@ public void testNumerousLocksPerClient() throws InterruptedException { assertThat(readWriteToken).isNotNull(); assertThat(readWriteToken.getClient()).isEqualTo(client); assertThat(readWriteToken.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); lockMap = new TreeMap<>(); for (int i = 0; i < numLocks; ++i) { @@ -864,7 +868,8 @@ public void testNumerousLocksPerClient() throws InterruptedException { server.lockWithFullLockResponse(client, requestAllLocks).getToken(); assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(client); - assertThat(token.getLockDescriptors()).isEqualTo(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); + assertThat(token.getLockDescriptors()) + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); server.unlock(token); server.unlock(readWriteToken); @@ -896,7 +901,8 @@ public void testNumerousLocksPerClient() throws InterruptedException { lockMap.put(StringLockDescriptor.of("lock " + i), LockMode.WRITE); } } - assertThat(token.getLockDescriptors()).isEqualTo(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); + assertThat(token.getLockDescriptors()) + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); server.unlock(token); lockMap = new TreeMap<>(); @@ -918,7 +924,8 @@ public void testNumerousLocksPerClient() throws InterruptedException { lockMap.put(StringLockDescriptor.of("lock " + i), LockMode.READ); } } - assertThat(token.getLockDescriptors()).isEqualTo(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); + assertThat(token.getLockDescriptors()) + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.copyOf(lockMap))); server.unlock(token); } @@ -991,7 +998,8 @@ public Void call() throws InterruptedException { } else { numSuccess.set(numSuccess.get() + 1); assertThat(token.getClient().getClientId()).isEqualTo(Integer.toString(clientID)); - assertThat(token.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token.getLockDescriptors()) + .containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); try { Thread.sleep(50); } catch (InterruptedException e) { @@ -1026,7 +1034,7 @@ public Void call() throws InterruptedException { server.lockWithFullLockResponse(LockClient.ANONYMOUS, request).getToken(); assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); - assertThat(token.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); server.unlock(token); } @@ -1049,7 +1057,7 @@ public void testExpiringTokensAndGrants() throws Exception { HeldLocksToken token = server.lockWithFullLockResponse(client, request).getToken(); assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(client); - assertThat(token.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); Thread.sleep(51); assertThat(token.getExpirationDateMs() - System.currentTimeMillis()).isLessThan(450); HeldLocksToken nullToken = @@ -1060,12 +1068,12 @@ public void testExpiringTokensAndGrants() throws Exception { token = server.lockWithFullLockResponse(LockClient.ANONYMOUS, request).getToken(); assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); - assertThat(token.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); HeldLocksGrant grant = server.convertToGrant(token); assertThat(grant).isNotNull(); assertThat(grant.getClient()).isNull(); - assertThat(grant.getLocks()).isEqualTo(request.getLockDescriptors()); + assertThat(grant.getLocks()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); Thread.sleep(51); assertThat(grant.getExpirationDateMs() - System.currentTimeMillis()).isLessThan(450); grant = server.refreshGrant(grant); @@ -1079,7 +1087,7 @@ public void testExpiringTokensAndGrants() throws Exception { token = server.lockWithFullLockResponse(client, request).getToken(); assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(client); - assertThat(token.getLockDescriptors()).isEqualTo(request.getLockDescriptors()); + assertThat(token.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request.getLockDescriptors()); server.unlock(token); assertThat(server.getTokens(client)).isEmpty(); } @@ -1097,7 +1105,7 @@ public void testConvertWriteToRead() throws Exception { server.lockWithFullLockResponse(client, request1).getToken(); assertThat(token1).isNotNull(); assertThat(token1.getClient()).isEqualTo(client); - assertThat(token1.getLockDescriptors()).isEqualTo(request1.getLockDescriptors()); + assertThat(token1.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request1.getLockDescriptors()); Future future = executor.submit((Callable) () -> { barrier.await(); @@ -1105,7 +1113,8 @@ public void testConvertWriteToRead() throws Exception { .getToken(); assertThat(validToken).isNotNull(); assertThat(validToken.getClient()).isEqualTo(LockClient.ANONYMOUS); - assertThat(validToken.getLockDescriptors()).isEqualTo(request2.getLockDescriptors()); + assertThat(validToken.getLockDescriptors()) + .containsExactlyInAnyOrderElementsOf(request2.getLockDescriptors()); assertThat(server.unlock(validToken)).isTrue(); return null; }); @@ -1115,7 +1124,7 @@ public void testConvertWriteToRead() throws Exception { server.lockWithFullLockResponse(client, request2).getToken(); assertThat(token2).isNotNull(); assertThat(token2.getClient()).isEqualTo(client); - assertThat(token2.getLockDescriptors()).isEqualTo(request2.getLockDescriptors()); + assertThat(token2.getLockDescriptors()).containsExactlyInAnyOrderElementsOf(request2.getLockDescriptors()); assertThat(server.unlock(token1)).isTrue(); future.get(); assertThat(server.unlock(token2)).isTrue(); @@ -1151,7 +1160,7 @@ public void testBoundaryConditions() throws InterruptedException { server.lockWithFullLockResponse(lockClient, request).getToken(); assertThat(token).isNotNull().extracting(HeldLocksToken::getClient).isEqualTo(lockClient); assertThat(token.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock, LockMode.READ))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock, LockMode.READ))); LockRequest request2 = LockRequest.builder(ImmutableSortedMap.of(lock, LockMode.WRITE)) .blockForAtMost(SimpleTimeDuration.of(0, TimeUnit.SECONDS)) @@ -1207,7 +1216,7 @@ public void testUnlockAndFreeze() throws Exception { assertThat(token).isNotNull(); assertThat(token.getClient()).isEqualTo(LockClient.ANONYMOUS); assertThat(token.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.WRITE))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.WRITE))); HeldLocksToken finalToken = token; assertThatThrownBy(() -> server.unlockAndFreeze(finalToken)) .describedAs("Expected: anonymous clients can't unlock and freeze") @@ -1221,7 +1230,7 @@ public void testUnlockAndFreeze() throws Exception { assertThat(token2).isNotNull(); assertThat(token2.getClient()).isEqualTo(client); assertThat(token2.getLockDescriptors()) - .isEqualTo(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.WRITE))); + .containsExactlyInAnyOrderElementsOf(LockCollections.of(ImmutableSortedMap.of(lock1, LockMode.WRITE))); server.unlockAndFreeze(token2); token2 = server.lockWithFullLockResponse(client, request).getToken(); assertThat(token2).isNull(); @@ -1245,7 +1254,7 @@ public void testUnlockAndFreeze() throws Exception { .build()) .getToken(); assertThat(token4).isNotNull(); - assertThat(server.getTokens(client)).isEqualTo(ImmutableSet.of(token4)); + assertThat(server.getTokens(client)).containsExactlyInAnyOrder(token4); token = server.lockWithFullLockResponse(client, request).getToken(); assertThat(token).isNull(); Thread.sleep(1000); diff --git a/lock-impl/src/test/java/com/palantir/lock/impl/ClientAwareLockTest.java b/lock-impl/src/test/java/com/palantir/lock/impl/ClientAwareLockTest.java index aef72b81809..abd8fba0bff 100644 --- a/lock-impl/src/test/java/com/palantir/lock/impl/ClientAwareLockTest.java +++ b/lock-impl/src/test/java/com/palantir/lock/impl/ClientAwareLockTest.java @@ -196,7 +196,7 @@ public void testFairness() throws Exception { anonymousReadLock.unlock(); anonymousWriteLock.lock(); assertThat(ImmutableList.copyOf(orderingQueue)) - .isEqualTo(ImmutableList.of("one", "two", "two", "three", "four", "five", "five")); + .containsExactly("one", "two", "two", "three", "four", "five", "five"); anonymousWriteLock.unlock(); } diff --git a/lock-impl/src/test/java/com/palantir/lock/impl/LegacyTimelockServiceTest.java b/lock-impl/src/test/java/com/palantir/lock/impl/LegacyTimelockServiceTest.java index 427aabae663..5d103ab5a1a 100644 --- a/lock-impl/src/test/java/com/palantir/lock/impl/LegacyTimelockServiceTest.java +++ b/lock-impl/src/test/java/com/palantir/lock/impl/LegacyTimelockServiceTest.java @@ -198,7 +198,7 @@ public void unlockReturnsSubsetThatWereUnlocked() { when(lockService.unlock(toLegacyToken(tokenB))).thenReturn(false); Set expected = ImmutableSet.of(tokenA); - assertThat(timelock.unlock(ImmutableSet.of(tokenA, tokenB))).isEqualTo(expected); + assertThat(timelock.unlock(ImmutableSet.of(tokenA, tokenB))).containsExactlyInAnyOrderElementsOf(expected); } private static LockToken randomLockToken() { diff --git a/lock-impl/src/test/java/com/palantir/lock/logger/LockServiceSerDeTest.java b/lock-impl/src/test/java/com/palantir/lock/logger/LockServiceSerDeTest.java index e85c3c10c32..993c23cb1fb 100644 --- a/lock-impl/src/test/java/com/palantir/lock/logger/LockServiceSerDeTest.java +++ b/lock-impl/src/test/java/com/palantir/lock/logger/LockServiceSerDeTest.java @@ -63,7 +63,7 @@ public void testSerialisationAndDeserialisationOfLockResponseWithLockHolders() t ObjectMapper mapper = new ObjectMapper(); LockResponse deserializedLockResponse = mapper.readValue(mapper.writeValueAsString(response), LockResponse.class); - assertThat(deserializedLockResponse.getLockHolders()).isEqualTo(lockHolders); + assertThat(deserializedLockResponse.getLockHolders()).containsExactlyInAnyOrderEntriesOf(lockHolders); } @Test diff --git a/timelock-agent/src/test/java/com/palantir/timelock/paxos/PaxosRemotingUtilsTest.java b/timelock-agent/src/test/java/com/palantir/timelock/paxos/PaxosRemotingUtilsTest.java index cbeccbb2179..f5c3443d1f4 100644 --- a/timelock-agent/src/test/java/com/palantir/timelock/paxos/PaxosRemotingUtilsTest.java +++ b/timelock-agent/src/test/java/com/palantir/timelock/paxos/PaxosRemotingUtilsTest.java @@ -81,19 +81,17 @@ private static void verifyQuorumSize(int nodes, int expected) { public void canGetRemoteServerPaths() { // foo should not be present, because it is the local server assertThat(PaxosRemotingUtils.getRemoteServerPaths(SSL_CLUSTER)) - .isEqualTo(ImmutableList.of("https://bar:2", "https://baz:3")); + .containsExactly("https://bar:2", "https://baz:3"); } @Test public void canGetClusterAddresses() { - assertThat(PaxosRemotingUtils.getClusterAddresses(SSL_CLUSTER)) - .isEqualTo(ImmutableList.of("foo:1", "bar:2", "baz:3")); + assertThat(PaxosRemotingUtils.getClusterAddresses(SSL_CLUSTER)).containsExactly("foo:1", "bar:2", "baz:3"); } @Test public void canGetRemoteServerAddresses() { - assertThat(PaxosRemotingUtils.getRemoteServerAddresses(SSL_CLUSTER)) - .isEqualTo(ImmutableList.of("bar:2", "baz:3")); + assertThat(PaxosRemotingUtils.getRemoteServerAddresses(SSL_CLUSTER)).containsExactly("bar:2", "baz:3"); } @Test @@ -117,13 +115,13 @@ public void addProtocolAddsHttpsIfSslPresent() { @Test public void addProtocolsAddsHttpIfSslNotPresent() { assertThat(PaxosRemotingUtils.addProtocols(NO_SSL_CLUSTER, ImmutableList.of("foo:1", "bar:2"))) - .isEqualTo(ImmutableList.of("http://foo:1", "http://bar:2")); + .containsExactly("http://foo:1", "http://bar:2"); } @Test public void addProtocolsAddsHttpsIfSslPresent() { assertThat(PaxosRemotingUtils.addProtocols(SSL_CLUSTER, ImmutableList.of("foo:1", "bar:2"))) - .isEqualTo(ImmutableList.of("https://foo:1", "https://bar:2")); + .containsExactly("https://foo:1", "https://bar:2"); } @Test diff --git a/timelock-corruption-detection/src/test/java/com/palantir/timelock/history/PaxosLogHistoryProviderTest.java b/timelock-corruption-detection/src/test/java/com/palantir/timelock/history/PaxosLogHistoryProviderTest.java index db6dea1b752..0875451058d 100644 --- a/timelock-corruption-detection/src/test/java/com/palantir/timelock/history/PaxosLogHistoryProviderTest.java +++ b/timelock-corruption-detection/src/test/java/com/palantir/timelock/history/PaxosLogHistoryProviderTest.java @@ -220,7 +220,7 @@ public void canFetchAndCombineHistoriesAcrossNamespaceAndUseCasePairs() { }) .collect(Collectors.toSet()); - assertThat(namespaceAndUseCasesWithHistory).isEqualTo(allNamespaceAndUseCases); + assertThat(namespaceAndUseCasesWithHistory).containsExactlyInAnyOrderElementsOf(allNamespaceAndUseCases); } // utils diff --git a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/batch/MultiClientConjureTimelockResourceTest.java b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/batch/MultiClientConjureTimelockResourceTest.java index 2d1192fba5d..d07bc869e0d 100644 --- a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/batch/MultiClientConjureTimelockResourceTest.java +++ b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/batch/MultiClientConjureTimelockResourceTest.java @@ -151,7 +151,7 @@ public void canGetCommitTimestampsForMultipleClients() { Set namespaces = ImmutableSet.of("client1", "client2"); assertThat(Futures.getUnchecked(resource.getCommitTimestampsForClients( AUTH_HEADER, getGetCommitTimestampsRequests(namespaces)))) - .isEqualTo(getGetCommitTimestampsResponseMap(namespaces)); + .containsExactlyInAnyOrderEntriesOf(getGetCommitTimestampsResponseMap(namespaces)); } private Map getGetCommitTimestampsResponseMap(Set namespaces) { diff --git a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockEventLogImplTest.java b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockEventLogImplTest.java index e8d2469dede..896330dcdb1 100644 --- a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockEventLogImplTest.java +++ b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockEventLogImplTest.java @@ -127,7 +127,7 @@ public void noKnownVersionReturnsSnapshotContainingCurrentMatchingLocks() { LockWatchStateUpdate.Snapshot snapshot = UpdateVisitors.assertSnapshot(update); assertThat(snapshot.lastKnownVersion()).isEqualTo(-1L); - assertThat(snapshot.locked()).isEqualTo(ImmutableSet.of(DESCRIPTOR_2, DESCRIPTOR_3)); + assertThat(snapshot.locked()).containsExactlyInAnyOrder(DESCRIPTOR_2, DESCRIPTOR_3); assertThat(snapshot.lockWatches()).containsExactly(entireTable); } @@ -141,7 +141,7 @@ public void snapshotIgnoresPreviousLogEntriesInLocksCalculation() { LockWatchStateUpdate.Snapshot snapshot = UpdateVisitors.assertSnapshot(update); assertThat(snapshot.lastKnownVersion()).isEqualTo(0L); - assertThat(snapshot.locked()).isEqualTo(ImmutableSet.of(DESCRIPTOR_2, DESCRIPTOR_3)); + assertThat(snapshot.locked()).containsExactlyInAnyOrder(DESCRIPTOR_2, DESCRIPTOR_3); assertThat(snapshot.lockWatches()).containsExactly(entireTable); } @@ -154,7 +154,7 @@ public void requestForTheFutureReturnsSnapshot() { LockWatchStateUpdate.Snapshot snapshot = UpdateVisitors.assertSnapshot(update); assertThat(snapshot.lastKnownVersion()).isEqualTo(-1L); - assertThat(snapshot.locked()).isEqualTo(ImmutableSet.of(DESCRIPTOR_2, DESCRIPTOR_3)); + assertThat(snapshot.locked()).containsExactlyInAnyOrder(DESCRIPTOR_2, DESCRIPTOR_3); assertThat(snapshot.lockWatches()).containsExactly(entireTable); } @@ -167,7 +167,7 @@ public void requestWithStaleLogIdReturnsSnapshot() { LockWatchStateUpdate.Snapshot snapshot = UpdateVisitors.assertSnapshot(update); assertThat(snapshot.lastKnownVersion()).isEqualTo(-1L); - assertThat(snapshot.locked()).isEqualTo(ImmutableSet.of(DESCRIPTOR_2, DESCRIPTOR_3)); + assertThat(snapshot.locked()).containsExactlyInAnyOrder(DESCRIPTOR_2, DESCRIPTOR_3); assertThat(snapshot.lockWatches()).containsExactly(entireTable); } diff --git a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockWatchingServiceImplTest.java b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockWatchingServiceImplTest.java index 85d82cb5533..98bf9ddf9d0 100644 --- a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockWatchingServiceImplTest.java +++ b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/lock/watch/LockWatchingServiceImplTest.java @@ -344,6 +344,6 @@ private static LockDescriptor descriptorForOtherTable() { private void assertLoggedEvents(List expectedEvents) { LockWatchStateUpdate update = lockWatcher.getWatchStateUpdate(Optional.of(LockWatchVersion.of(LOG_ID, -1L))); List events = UpdateVisitors.assertSuccess(update).events(); - assertThat(events).isEqualTo(expectedEvents); + assertThat(events).containsExactlyElementsOf(expectedEvents); } } diff --git a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/paxos/PaxosQuorumCheckingCoalescingFunctionTests.java b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/paxos/PaxosQuorumCheckingCoalescingFunctionTests.java index 95aee69c089..b174c29ab8f 100644 --- a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/paxos/PaxosQuorumCheckingCoalescingFunctionTests.java +++ b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/paxos/PaxosQuorumCheckingCoalescingFunctionTests.java @@ -73,7 +73,7 @@ public void successfullyCombinesAndDeconstructs() { Map> results = paxosQuorumChecker.apply(ImmutableSet.of(1L, 2L, 5L)); - assertThat(results).isEqualTo(expected); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expected); } @Test @@ -96,7 +96,7 @@ public void individualRequestsCanHaveQuorumFailures() { Map> results = paxosQuorumChecker.apply(ImmutableSet.of(1L, 2L, 5L)); - assertThat(results).isEqualTo(expected); + assertThat(results).containsExactlyInAnyOrderEntriesOf(expected); } private PaxosQuorumCheckingCoalescingFunction paxosQuorumCheckerFor( diff --git a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/transaction/client/CachingPartitionAllocatorTest.java b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/transaction/client/CachingPartitionAllocatorTest.java index 1bae6c23e4b..f2d22f065ec 100644 --- a/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/transaction/client/CachingPartitionAllocatorTest.java +++ b/timelock-impl/src/test/java/com/palantir/atlasdb/timelock/transaction/client/CachingPartitionAllocatorTest.java @@ -57,7 +57,7 @@ public void cachesResults() { verify(generator, times(1)).getAndMarkResidue(); verifyNoMoreInteractions(generator); - assertThat(firstResponse).isEqualTo(secondResponse).isEqualTo(thirdResponse); + assertThat(firstResponse).containsExactlyElementsOf(secondResponse).containsExactlyElementsOf(thirdResponse); } @Test diff --git a/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/HeldLocksCollectionTest.java b/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/HeldLocksCollectionTest.java index 83fda4f6aae..91fad66e66e 100644 --- a/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/HeldLocksCollectionTest.java +++ b/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/HeldLocksCollectionTest.java @@ -112,7 +112,7 @@ public void refreshReturnsSubsetOfUnlockedLocks() { .refresh(ImmutableSet.of(unlockableRequest, nonUnlockableRequest)) .value(); - assertThat(actual).isEqualTo(expected); + assertThat(actual).containsExactlyInAnyOrderElementsOf(expected); } @Test @@ -123,7 +123,7 @@ public void unlockReturnsSubsetOfUnlockedLocks() { Set expected = ImmutableSet.of(refreshableRequest); Set actual = heldLocksCollection.unlock(ImmutableSet.of(refreshableRequest, nonRefreshableRequest)); - assertThat(actual).isEqualTo(expected); + assertThat(actual).containsExactlyInAnyOrderElementsOf(expected); } @Test diff --git a/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/LockCollectionTest.java b/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/LockCollectionTest.java index f91c530ad13..0ff728a26bd 100644 --- a/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/LockCollectionTest.java +++ b/timelock-server/src/test/java/com/palantir/atlasdb/timelock/lock/LockCollectionTest.java @@ -49,7 +49,7 @@ public void returnsSameLockForMultipleRequests() { List locks1 = lockCollection.getAll(descriptors).get(); List locks2 = lockCollection.getAll(descriptors).get(); - assertThat(locks1).isEqualTo(locks2); + assertThat(locks1).containsExactlyElementsOf(locks2); } @Test @@ -67,7 +67,7 @@ public void returnsLocksInOrder() { List actualOrder = lockCollection.getAll(ImmutableSet.copyOf(orderedDescriptors)).get(); - assertThat(actualOrder).isEqualTo(expectedOrder); + assertThat(actualOrder).containsExactlyElementsOf(expectedOrder); } private static Set descriptors(String... names) {