1/* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 6package org.mockito.internal.matchers; 7 8import org.mockito.ArgumentMatcher; 9 10import java.io.Serializable; 11 12public 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