All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.insightfullogic.lambdabehave.expectations.StringExpectation Maven / Gradle / Ivy

There is a newer version: 0.4
Show newest version
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 {
    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 matcher) {
        assertThat(objectUnderTest, matcher);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy