Home | History | Annotate | Download | only in matchers
      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 org.mockito.ArgumentMatcher;
      9 
     10 import java.io.Serializable;
     11 
     12 
     13 public class Contains implements ArgumentMatcher<String>, Serializable {
     14 
     15     private final String substring;
     16 
     17     public Contains(String substring) {
     18         this.substring = substring;
     19     }
     20 
     21     public boolean matches(String actual) {
     22         return actual != null && actual.contains(substring);
     23     }
     24 
     25     public String toString() {
     26         return "contains(\"" + substring + "\")";
     27     }
     28 }
     29