From 66eb86f0552b80b03b338c69ac83cd5f70c799e4 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 8 May 2019 09:49:03 -0700 Subject: [PATCH] Delete unused Matchers class Delete the `Matches` class since it's no longer being used. --- .../org/springframework/tests/Matchers.java | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 spring-core/src/test/java/org/springframework/tests/Matchers.java diff --git a/spring-core/src/test/java/org/springframework/tests/Matchers.java b/spring-core/src/test/java/org/springframework/tests/Matchers.java deleted file mode 100644 index 1ffd980e95..0000000000 --- a/spring-core/src/test/java/org/springframework/tests/Matchers.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2002-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.tests; - -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.junit.Rule; - -/** - * Additional hamcrest matchers. - * - * @author Phillip Webb - */ -public class Matchers { - - /** - * Create a matcher that wrapps the specified matcher and tests against the - * {@link Throwable#getCause() cause} of an exception. If the item tested - * is {@code null} not a {@link Throwable} the wrapped matcher will be called - * with a {@code null} item. - * - *

Often useful when working with JUnit {@link ExpectedException} - * {@link Rule @Rule}s, for example: - *

-	 * thrown.expect(DataAccessException.class);
-	 * thrown.except(exceptionCause(isA(SQLException.class)));
-	 * 
- * - * @param matcher the matcher to wrap (must not be null) - * @return a matcher that tests using the exception cause - */ - @SuppressWarnings("unchecked") - public static Matcher exceptionCause(final Matcher matcher) { - return (Matcher) new BaseMatcher() { - @Override - public boolean matches(Object item) { - Throwable cause = null; - if (item != null && item instanceof Throwable) { - cause = ((Throwable)item).getCause(); - } - return matcher.matches(cause); - } - - @Override - public void describeTo(Description description) { - description.appendText("exception cause ").appendDescriptionOf(matcher); - } - }; - } - -}