carbidecpp22devenv/plugins/org.eclipse.test.source_3.5.0.r20080925/src/org.junit4_4.5.0.v20090423/junitsrc/org/junit/internal/matchers/StringContains.java
author cawthron
Fri, 04 Dec 2009 12:29:56 -0600
changeset 779 4870ed7d9d38
parent 636 3ef299ba838f
permissions -rw-r--r--
remove .branch.txt

/*  Copyright (c) 2000-2006 hamcrest.org
 */
package org.junit.internal.matchers;

import org.hamcrest.Factory;
import org.hamcrest.Matcher;

/**
 * Tests if the argument is a string that contains a substring.
 */
public class StringContains extends SubstringMatcher {
    public StringContains(String substring) {
        super(substring);
    }

    @Override
	protected boolean evalSubstringOf(String s) {
        return s.indexOf(substring) >= 0;
    }

    @Override
	protected String relationship() {
        return "containing";
    }

    @Factory
    public static Matcher<String> containsString(String substring) {
        return new StringContains(substring);
    }

}