Package org.elasticsearch.test.hamcrest
Class ElasticsearchAssertions
java.lang.Object
org.elasticsearch.test.hamcrest.ElasticsearchAssertions
public class ElasticsearchAssertions
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description ElasticsearchAssertions()
-
Method Summary
Modifier and Type Method Description static void
assertAcked(org.elasticsearch.action.admin.indices.create.CreateIndexResponse response)
Assert that an index creation was fully acknowledged, meaning that both the index creation cluster state update was successful and that the requisite number of shard copies were started before returning.static void
assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder builder)
static void
assertAcked(org.elasticsearch.action.support.master.AcknowledgedRequestBuilder<?,?,?> builder)
static void
assertAcked(org.elasticsearch.action.support.master.AcknowledgedResponse response)
static void
assertAliasesExist(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
Assert that aliases existstatic void
assertAliasesMissing(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
Assert that aliases are missingstatic void
assertAllSuccessful(org.elasticsearch.action.search.SearchResponse response)
static void
assertAllSuccessful(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
static void
assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder)
Executes the request and fails if the request has not been blocked.static void
assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder, java.lang.Integer expectedBlockId)
Executes the request and fails if the request has not been blocked by a specificClusterBlock
.static void
assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder, org.elasticsearch.cluster.block.ClusterBlock expectedBlock)
Executes the request and fails if the request has not been blocked by a specificClusterBlock
.static void
assertBlocked(org.elasticsearch.action.support.broadcast.BroadcastResponse replicatedBroadcastResponse)
Checks that all shard requests of a replicated broadcast request failed due to a cluster blockstatic <T extends org.apache.lucene.search.Query>
TassertBooleanSubQuery(org.apache.lucene.search.Query query, java.lang.Class<T> subqueryType, int i)
static <T extends org.apache.lucene.search.Query>
TassertDisjunctionSubQuery(org.apache.lucene.search.Query query, java.lang.Class<T> subqueryType, int i)
static void
assertExists(org.elasticsearch.action.get.GetResponse response)
static void
assertFailures(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder, org.elasticsearch.rest.RestStatus restStatus, org.hamcrest.Matcher<java.lang.String> reasonMatcher)
static void
assertFailures(org.elasticsearch.action.search.SearchResponse searchResponse)
static void
assertFileExists(java.nio.file.Path file)
Check if a file existsstatic void
assertFileNotExists(java.nio.file.Path file)
Check if a file does not existstatic void
assertFirstHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
static void
assertFourthHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
static <E extends java.lang.Throwable>
voidassertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass)
Run future.actionGet() and check that it throws an exception of the right typestatic <E extends java.lang.Throwable>
voidassertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)
Run future.actionGet() and check that it throws an exception of the right typestatic <E extends java.lang.Throwable>
voidassertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)
Run future.actionGet() and check that it throws an exception of the right type, with a givenRestStatus
static <E extends java.lang.Throwable>
voidassertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo)
Run future.actionGet() and check that it throws an exception of the right type, optionally checking the exception's rest statusstatic void
assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, org.elasticsearch.rest.RestStatus status)
static void
assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo)
static void
assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher)
static void
assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher)
static void
assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher)
static void
assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher)
static void
assertHitCount(org.elasticsearch.action.search.SearchResponse countResponse, long expectedHitCount)
static void
assertIndexTemplateExists(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)
Assert that an index template existsstatic void
assertIndexTemplateMissing(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)
Assert that an index template is missingstatic void
assertNoFailures(org.elasticsearch.action.bulk.BulkResponse response)
static void
assertNoFailures(org.elasticsearch.action.search.SearchResponse searchResponse)
static void
assertNoFailures(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
static void
assertNoSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse)
static void
assertNotHighlighted(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field)
static void
assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder requestBuilder)
static void
assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse response)
static void
assertOrderedSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids)
static <E extends java.lang.Throwable>
voidassertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass)
Run the request from a given builder and check that it throws an exception of the right typestatic <E extends java.lang.Throwable>
voidassertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)
Run the request from a given builder and check that it throws an exception of the right typestatic <E extends java.lang.Throwable>
voidassertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)
Run the request from a given builder and check that it throws an exception of the right type, with a givenRestStatus
static void
assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, org.elasticsearch.rest.RestStatus status)
static void
assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo)
static void
assertSearchHit(org.elasticsearch.action.search.SearchResponse searchResponse, int number, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
static void
assertSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids)
static org.elasticsearch.action.search.SearchResponse
assertSearchResponse(org.elasticsearch.action.search.SearchRequestBuilder request)
Applies basic assertions on the SearchResponse.static org.elasticsearch.action.search.SearchResponse
assertSearchResponse(org.elasticsearch.action.search.SearchResponse response)
Applies basic assertions on the SearchResponse.static void
assertSecondHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
static void
assertSortValues(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.Object[]... sortValues)
static void
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int ord, java.lang.String key, java.lang.String text)
static void
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, int size, java.lang.String... text)
Assert suggestion returns size suggestions and the first are the provided text.static void
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, java.lang.String... text)
Assert suggestion returns exactly the provided text.static void
assertSuggestionPhraseCollateMatchExists(org.elasticsearch.search.suggest.Suggest searchSuggest, java.lang.String key, int numberOfPhraseExists)
static void
assertSuggestionSize(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int size, java.lang.String key)
static void
assertThirdHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
static void
assertToXContentEquivalent(org.elasticsearch.common.bytes.BytesReference expected, org.elasticsearch.common.bytes.BytesReference actual, org.elasticsearch.common.xcontent.XContentType xContentType)
Asserts that the providedBytesReference
s created throughToXContent.toXContent(XContentBuilder, ToXContent.Params)
hold the same content.static void
awaitLatch(java.util.concurrent.CountDownLatch latch, long timeout, java.util.concurrent.TimeUnit unit)
Wait for a latch to countdown and provide a useful error message if it does not Often latches are called asassertTrue(latch.await(1, TimeUnit.SECONDS));
In case of a failure this will just throw an assertion error without any further messagestatic java.util.function.Function<org.elasticsearch.search.SearchHit,java.lang.Object>
fieldFromSource(java.lang.String fieldName)
static java.lang.String
formatShardStatus(org.elasticsearch.action.search.SearchResponse response)
static java.lang.String
formatShardStatus(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit>
hasId(java.lang.String id)
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit>
hasIndex(java.lang.String index)
static <T, V> org.hamcrest.core.CombinableMatcher<T>
hasProperty(java.util.function.Function<? super T,? extends V> property, org.hamcrest.Matcher<V> valueMatcher)
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit>
hasScore(float score)
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit>
hasType(java.lang.String type)
-
Constructor Details
-
ElasticsearchAssertions
public ElasticsearchAssertions()
-
-
Method Details
-
assertAcked
public static void assertAcked(org.elasticsearch.action.support.master.AcknowledgedRequestBuilder<?,?,?> builder) -
assertNoTimeout
public static void assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder requestBuilder) -
assertNoTimeout
public static void assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse response) -
assertAcked
public static void assertAcked(org.elasticsearch.action.support.master.AcknowledgedResponse response) -
assertAcked
public static void assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder builder) -
assertAcked
public static void assertAcked(org.elasticsearch.action.admin.indices.create.CreateIndexResponse response)Assert that an index creation was fully acknowledged, meaning that both the index creation cluster state update was successful and that the requisite number of shard copies were started before returning. -
assertBlocked
public static void assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder)Executes the request and fails if the request has not been blocked.- Parameters:
builder
- the request builder
-
assertBlocked
public static void assertBlocked(org.elasticsearch.action.support.broadcast.BroadcastResponse replicatedBroadcastResponse)Checks that all shard requests of a replicated broadcast request failed due to a cluster block- Parameters:
replicatedBroadcastResponse
- the response that should only contain failed shard responses
-
assertBlocked
public static void assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder, @Nullable java.lang.Integer expectedBlockId)Executes the request and fails if the request has not been blocked by a specificClusterBlock
.- Parameters:
builder
- the request builderexpectedBlockId
- the expected block id
-
assertBlocked
public static void assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder, @Nullable org.elasticsearch.cluster.block.ClusterBlock expectedBlock)Executes the request and fails if the request has not been blocked by a specificClusterBlock
.- Parameters:
builder
- the request builderexpectedBlock
- the expected block
-
formatShardStatus
public static java.lang.String formatShardStatus(org.elasticsearch.action.support.broadcast.BroadcastResponse response) -
formatShardStatus
public static java.lang.String formatShardStatus(org.elasticsearch.action.search.SearchResponse response) -
assertNoSearchHits
public static void assertNoSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse) -
assertSearchHits
public static void assertSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids) -
assertSortValues
public static void assertSortValues(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.Object[]... sortValues) -
assertOrderedSearchHits
public static void assertOrderedSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids) -
assertHitCount
public static void assertHitCount(org.elasticsearch.action.search.SearchResponse countResponse, long expectedHitCount) -
assertExists
public static void assertExists(org.elasticsearch.action.get.GetResponse response) -
assertFirstHit
public static void assertFirstHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) -
assertSecondHit
public static void assertSecondHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) -
assertThirdHit
public static void assertThirdHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) -
assertFourthHit
public static void assertFourthHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) -
assertSearchHit
public static void assertSearchHit(org.elasticsearch.action.search.SearchResponse searchResponse, int number, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) -
assertNoFailures
public static void assertNoFailures(org.elasticsearch.action.search.SearchResponse searchResponse) -
assertFailures
public static void assertFailures(org.elasticsearch.action.search.SearchResponse searchResponse) -
assertNoFailures
public static void assertNoFailures(org.elasticsearch.action.bulk.BulkResponse response) -
assertFailures
public static void assertFailures(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder, org.elasticsearch.rest.RestStatus restStatus, org.hamcrest.Matcher<java.lang.String> reasonMatcher) -
assertNoFailures
public static void assertNoFailures(org.elasticsearch.action.support.broadcast.BroadcastResponse response) -
assertAllSuccessful
public static void assertAllSuccessful(org.elasticsearch.action.support.broadcast.BroadcastResponse response) -
assertAllSuccessful
public static void assertAllSuccessful(org.elasticsearch.action.search.SearchResponse response) -
assertHighlight
public static void assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher) -
assertHighlight
public static void assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher) -
assertHighlight
public static void assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher) -
assertHighlight
public static void assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher) -
assertNotHighlighted
public static void assertNotHighlighted(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field) -
assertSuggestionSize
public static void assertSuggestionSize(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int size, java.lang.String key) -
assertSuggestionPhraseCollateMatchExists
public static void assertSuggestionPhraseCollateMatchExists(org.elasticsearch.search.suggest.Suggest searchSuggest, java.lang.String key, int numberOfPhraseExists) -
assertSuggestion
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int ord, java.lang.String key, java.lang.String text) -
assertSuggestion
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, java.lang.String... text)Assert suggestion returns exactly the provided text. -
assertSuggestion
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, int size, java.lang.String... text)Assert suggestion returns size suggestions and the first are the provided text. -
assertIndexTemplateMissing
public static void assertIndexTemplateMissing(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)Assert that an index template is missing -
assertIndexTemplateExists
public static void assertIndexTemplateExists(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)Assert that an index template exists -
assertAliasesMissing
public static void assertAliasesMissing(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)Assert that aliases are missing -
assertAliasesExist
public static void assertAliasesExist(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)Assert that aliases exist -
hasId
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasId(java.lang.String id) -
hasType
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasType(java.lang.String type) -
hasIndex
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasIndex(java.lang.String index) -
hasScore
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasScore(float score) -
hasProperty
public static <T, V> org.hamcrest.core.CombinableMatcher<T> hasProperty(java.util.function.Function<? super T,? extends V> property, org.hamcrest.Matcher<V> valueMatcher) -
fieldFromSource
public static java.util.function.Function<org.elasticsearch.search.SearchHit,java.lang.Object> fieldFromSource(java.lang.String fieldName) -
assertBooleanSubQuery
public static <T extends org.apache.lucene.search.Query> T assertBooleanSubQuery(org.apache.lucene.search.Query query, java.lang.Class<T> subqueryType, int i) -
assertDisjunctionSubQuery
public static <T extends org.apache.lucene.search.Query> T assertDisjunctionSubQuery(org.apache.lucene.search.Query query, java.lang.Class<T> subqueryType, int i) -
assertRequestBuilderThrows
public static <E extends java.lang.Throwable> void assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass)Run the request from a given builder and check that it throws an exception of the right type -
assertRequestBuilderThrows
public static <E extends java.lang.Throwable> void assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)Run the request from a given builder and check that it throws an exception of the right type, with a givenRestStatus
-
assertRequestBuilderThrows
public static <E extends java.lang.Throwable> void assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)Run the request from a given builder and check that it throws an exception of the right type- Parameters:
extraInfo
- extra information to add to the failure message
-
assertFutureThrows
public static <E extends java.lang.Throwable> void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass)Run future.actionGet() and check that it throws an exception of the right type -
assertFutureThrows
public static <E extends java.lang.Throwable> void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)Run future.actionGet() and check that it throws an exception of the right type, with a givenRestStatus
-
assertFutureThrows
public static <E extends java.lang.Throwable> void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)Run future.actionGet() and check that it throws an exception of the right type- Parameters:
extraInfo
- extra information to add to the failure message
-
assertFutureThrows
public static <E extends java.lang.Throwable> void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, java.lang.Class<E> exceptionClass, @Nullable org.elasticsearch.rest.RestStatus status, @Nullable java.lang.String extraInfo)Run future.actionGet() and check that it throws an exception of the right type, optionally checking the exception's rest status- Parameters:
exceptionClass
- expected exception classstatus
-RestStatus
to check for. Can be null to disable the checkextraInfo
- extra information to add to the failure message. Can be null.
-
assertRequestBuilderThrows
public static void assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, org.elasticsearch.rest.RestStatus status) -
assertRequestBuilderThrows
public static void assertRequestBuilderThrows(org.elasticsearch.action.ActionRequestBuilder<?,?> builder, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo) -
assertFutureThrows
public static void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, org.elasticsearch.rest.RestStatus status) -
assertFutureThrows
public static void assertFutureThrows(org.elasticsearch.action.ActionFuture<?> future, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo) -
assertSearchResponse
public static org.elasticsearch.action.search.SearchResponse assertSearchResponse(org.elasticsearch.action.search.SearchRequestBuilder request)Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if any of the shards threw an exception and if the response is serializable. -
assertSearchResponse
public static org.elasticsearch.action.search.SearchResponse assertSearchResponse(org.elasticsearch.action.search.SearchResponse response)Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if any of the shards threw an exception and if the response is serializable. -
assertFileExists
public static void assertFileExists(java.nio.file.Path file)Check if a file exists -
assertFileNotExists
public static void assertFileNotExists(java.nio.file.Path file)Check if a file does not exist -
assertToXContentEquivalent
public static void assertToXContentEquivalent(org.elasticsearch.common.bytes.BytesReference expected, org.elasticsearch.common.bytes.BytesReference actual, org.elasticsearch.common.xcontent.XContentType xContentType) throws java.io.IOExceptionAsserts that the providedBytesReference
s created throughToXContent.toXContent(XContentBuilder, ToXContent.Params)
hold the same content. The comparison is done by parsing both into a map and comparing those two, so that keys ordering doesn't matter. Also binary values (byte[]) are properly compared through arrays comparisons.- Throws:
java.io.IOException
-
awaitLatch
public static void awaitLatch(java.util.concurrent.CountDownLatch latch, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionWait for a latch to countdown and provide a useful error message if it does not Often latches are called asassertTrue(latch.await(1, TimeUnit.SECONDS));
In case of a failure this will just throw an assertion error without any further message- Parameters:
latch
- The latch to wait fortimeout
- The value of the timeoutunit
- The unit of the timeout- Throws:
java.lang.InterruptedException
- An exception if the waiting is interrupted
-