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 public class StartsWith implements ArgumentMatcher<String>, Serializable { 13 14 private final String prefix; 15 16 public StartsWith(String prefix) { 17 this.prefix = prefix; 18 } 19 20 public boolean matches(String actual) { 21 return actual != null && actual.startsWith(prefix); 22 } 23 24 public String toString() { 25 return "startsWith(\"" + prefix + "\")"; 26 } 27 } 28