/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. * */ package org.opensearch.test.framework.matcher; import org.hamcrest.Matcher; import org.opensearch.core.rest.RestStatus; import static org.hamcrest.Matchers.containsString; public class OpenSearchExceptionMatchers { private OpenSearchExceptionMatchers() {} public static Matcher statusException(RestStatus expectedRestStatus) { return new OpenSearchStatusExceptionMatcher(expectedRestStatus); } public static Matcher errorMessage(Matcher errorMessageMatcher) { return new ExceptionErrorMessageMatcher(errorMessageMatcher); } public static Matcher errorMessageContain(String errorMessage) { return errorMessage(containsString(errorMessage)); } public static Matcher hasCause(Class clazz) { return new ExceptionHasCauseMatcher(clazz); } }