• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito.internal.hamcrest;
6 
7 import org.hamcrest.Matcher;
8 import org.hamcrest.StringDescription;
9 import org.mockito.ArgumentMatcher;
10 import org.mockito.internal.matchers.VarargMatcher;
11 
12 public class HamcrestArgumentMatcher<T> implements ArgumentMatcher<T> {
13 
14     private final Matcher matcher;
15 
HamcrestArgumentMatcher(Matcher<T> matcher)16     public HamcrestArgumentMatcher(Matcher<T> matcher) {
17         this.matcher = matcher;
18     }
19 
matches(Object argument)20     public boolean matches(Object argument) {
21         return this.matcher.matches(argument);
22     }
23 
isVarargMatcher()24     public boolean isVarargMatcher() {
25         return matcher instanceof VarargMatcher;
26     }
27 
toString()28     public String toString() {
29         //TODO SF add unit tests and integ test coverage for describeTo()
30         return StringDescription.toString(matcher);
31     }
32 }
33