Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.elasticsearch.health.HealthStatus.RED;
import static org.elasticsearch.health.ServerHealthComponents.SNAPSHOT;
import static org.elasticsearch.snapshots.RepositoryIntegrityHealthIndicatorService.NAME;
import static org.elasticsearch.test.hamcrest.ThrowableAssertions.assertThatThrows;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;

Expand Down Expand Up @@ -58,9 +57,8 @@ public void testRepositoryIntegrityHealthIndicator() throws IOException, Interru
corruptRepository(repository, location);
// Currently, the health indicator is not proactively checking the repository and
// instead relies on other operations to detect and flag repository corruption
assertThatThrows(
() -> createFullSnapshot(repository, "snapshot-2"),
RepositoryException.class,
assertThat(
expectThrows(RepositoryException.class, () -> createFullSnapshot(repository, "snapshot-2")).getMessage(),
containsString("[" + repository + "] Could not read repository data")
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
import java.util.function.Consumer;
import java.util.function.Function;

import static org.elasticsearch.test.hamcrest.ThrowableAssertions.assertThatException;
import static org.elasticsearch.test.hamcrest.ThrowableAssertions.assertThatThrows;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.isA;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -188,9 +187,8 @@ public void testRemoveUnknownRepositoryTypeWhenApplyingClusterState() {
repositoriesService.applyClusterState(new ClusterChangedEvent("starting", clusterState, emptyState()));
repositoriesService.applyClusterState(new ClusterChangedEvent("removing repo", emptyState(), clusterState));

assertThatThrows(
() -> repositoriesService.repository(repoName),
RepositoryMissingException.class,
assertThat(
expectThrows(RepositoryMissingException.class, () -> repositoriesService.repository(repoName)).getMessage(),
equalTo("[" + repoName + "] missing")
);
}
Expand All @@ -207,7 +205,8 @@ public void onResponse(AcknowledgedResponse acknowledgedResponse) {

@Override
public void onFailure(Exception e) {
assertThatException(e, RepositoryException.class, equalTo("[" + repoName + "] repository type [unknown] does not exist"));
assertThat(e, isA(RepositoryException.class));
assertThat(e.getMessage(), equalTo("[" + repoName + "] repository type [unknown] does not exist"));
}
});
}
Expand Down

This file was deleted.