1/*  Copyright (c) 2000-2006 hamcrest.org
2 */
3package org.hamcrest.text;
4
5import org.hamcrest.Factory;
6import org.hamcrest.Matcher;
7
8/**
9 * Tests if the argument is a string that contains a substring.
10 */
11public class StringEndsWith extends SubstringMatcher {
12    public StringEndsWith(String substring) {
13        super(substring);
14    }
15
16    protected boolean evalSubstringOf(String s) {
17        return s.endsWith(substring);
18    }
19
20    protected String relationship() {
21        return "ending with";
22    }
23
24    @Factory
25    public static Matcher<String> endsWith(String substring) {
26        return new StringEndsWith(substring);
27    }
28
29}
30