1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 6 package org.mockito.internal.matchers; 7 8 import java.io.Serializable; 9 10 import org.mockito.ArgumentMatcher; 11 12 @SuppressWarnings({ "unchecked", "serial","rawtypes" }) 13 public class And implements ArgumentMatcher<Object>, Serializable { 14 private ArgumentMatcher m1; 15 private ArgumentMatcher m2; 16 And(ArgumentMatcher<?> m1, ArgumentMatcher<?> m2)17 public And(ArgumentMatcher<?> m1, ArgumentMatcher<?> m2) { 18 this.m1 = m1; 19 this.m2 = m2; 20 } 21 matches(Object actual)22 public boolean matches(Object actual) { 23 return m1.matches(actual) && m2.matches(actual); 24 } 25 toString()26 public String toString() { 27 return "and("+m1+", "+m2+")"; 28 } 29 } 30