aboutsummaryrefslogtreecommitdiff
path: root/hamcrest-library/src/main/java/org/hamcrest/text/StringEndsWith.java
blob: 10e4764cc74c8bc7ab4dadf8e7f0c5d146152962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*  Copyright (c) 2000-2006 hamcrest.org
 */
package org.hamcrest.text;

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

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

    protected boolean evalSubstringOf(String s) {
        return s.endsWith(substring);
    }

    protected String relationship() {
        return "ending with";
    }

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

}