package com.insightfullogic.lambdabehave.expectations;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import static org.junit.Assert.assertThat;

/**
 * .
 */
public final class StringExpectation extends BoundExpectation<String> {
    public StringExpectation(final String str, final boolean positive) {
        super(str, positive);
    }

    public StringExpectation isEmptyString() {
        return matches(Matchers.isEmptyString());
    }

    public StringExpectation isEmptyOrNullString() {
        return matches(Matchers.isEmptyOrNullString());
    }

    public StringExpectation equalToIgnoringCase(final String expectedString) {
        return matches(Matchers.equalToIgnoringCase(expectedString));
    }

    public StringExpectation equalToIgnoringWhiteSpace(final String expectedString) {
        return matches(Matchers.equalToIgnoringWhiteSpace(expectedString));
    }

    public StringExpectation containsString(final String substring) {
        return matches(Matchers.containsString(substring));
    }

    public StringExpectation endsWith(final String suffix) {
        return matches(Matchers.endsWith(suffix));
    }

    public StringExpectation startsWith(final String prefix) {
        return matches(Matchers.startsWith(prefix));
    }

    private StringExpectation matches(final Matcher<String> matcher) {
        assertThat(objectUnderTest, matcher);
        return this;
    }
}

@@ -151,16 +151,59 @@
 ertThat;
+%0Aimport static org.junit.Assert.assertTrue;
 %0A%0A/**%0A *
@@ -1460,10 +1460,144 @@
 ;%0A    %7D%0A
+%0A    public StringExpectation matches(String regex) %7B%0A        assertTrue(objectUnderTest.matches(regex));%0A        return this;%0A    %7D%0A%0A
 %7D%0A

Add method to check if a string matches a regular expression