/** * Creates a matcher of {@link String} that matches when the examined string has zero length. * <p/> * For example: * <pre>assertThat("", isEmptyString())</pre> */ public static org.hamcrest.Matcher<java.lang.String> isEmptyString() { return org.hamcrest.text.IsEmptyString.isEmptyString(); }
/** * Creates a matcher of {@link String} that matches when the examined string is <code>null</code>, or * has zero length. * <p/> * For example: * <pre>assertThat(((String)null), isEmptyString())</pre> */ public static org.hamcrest.Matcher<java.lang.String> isEmptyOrNullString() { return org.hamcrest.text.IsEmptyString.isEmptyOrNullString(); }
/** * Creates a matcher of {@link String} that matches when the examined string is <code>null</code>, or * has zero length. * For example: * <pre>assertThat(((String)null), is(emptyOrNullString()))</pre> */ public static Matcher<java.lang.String> emptyOrNullString() { return org.hamcrest.text.IsEmptyString.emptyOrNullString(); }
@Test public void matchesNullAppropriately() { assertMatches(emptyOrNullString(), null); assertDoesNotMatch(emptyString(), null); }
/** * Creates a matcher of {@link String} that matches when the examined string has zero length. * For example: * <pre>assertThat("", is(emptyString()))</pre> */ public static Matcher<java.lang.String> emptyString() { return org.hamcrest.text.IsEmptyString.emptyString(); }
@Test public void doesNotMatchFilledString() { assertDoesNotMatch(emptyString(), "a"); assertDoesNotMatch(emptyOrNullString(), "a"); }
/** * Creates a matcher of {@link String} that matches when the examined string has zero length. * For example: * <pre>assertThat("", isEmptyString())</pre> * * @deprecated use is(emptyString()) instead */ @Deprecated public static Matcher<String> isEmptyString() { return emptyString(); }
/** * Creates a matcher of {@link String} that matches when the examined string has zero length. * For example: * <pre>assertThat("", isEmptyString())</pre> * * @deprecated use is(emptyString()) instead */ @SuppressWarnings("deprecation") public static Matcher<java.lang.String> isEmptyString() { return org.hamcrest.text.IsEmptyString.isEmptyString(); }
/** * Creates a matcher of {@link String} that matches when the examined string is <code>null</code>, or * has zero length. * For example: * <pre>assertThat(((String)null), isEmptyOrNullString())</pre> * * @deprecated use is(emptyOrNullString()) instead */ @SuppressWarnings("deprecation") public static Matcher<java.lang.String> isEmptyOrNullString() { return org.hamcrest.text.IsEmptyString.isEmptyOrNullString(); }
@Test public void matchesBlankStringAppropriately() { assertDoesNotMatch(emptyString(), " "); assertDoesNotMatch(emptyOrNullString(), " "); }
@Test public void copesWithNullsAndUnknownTypes() { Matcher<String> matcher = emptyString(); assertNullSafe(matcher); assertUnknownTypeSafe(matcher); }
/** * Creates a matcher of {@link String} that matches when the examined string is <code>null</code>, or * has zero length. * For example: * <pre>assertThat(((String)null), isEmptyOrNullString())</pre> * * @deprecated use is(emptyOrNullString()) instead * */ @Deprecated public static Matcher<String> isEmptyOrNullString() { return emptyOrNullString(); }
public void isEmpty() { verifyUsingMatcher(IsEmptyString.isEmptyString()); }
public void isNullOrEmpty() { verifyUsingMatcher(IsEmptyString.isEmptyOrNullString()); }
@Test public void describesAMismatch() { assertMismatchDescription("was \"a\"", emptyString(), "a"); assertMismatchDescription("was \"a\"", emptyOrNullString(), "a"); } }
/** * Creates a matcher of {@link String} that matches when the examined string has zero length. * For example: * <pre>assertThat("", is(emptyString()))</pre> */ public static org.hamcrest.Matcher<java.lang.String> emptyString() { return org.hamcrest.text.IsEmptyString.emptyString(); }
/** * Creates a matcher of {@link String} that matches when the examined string is <code>null</code>, or * has zero length. * For example: * <pre>assertThat(((String)null), is(emptyOrNullString()))</pre> */ public static org.hamcrest.Matcher<java.lang.String> emptyOrNullString() { return org.hamcrest.text.IsEmptyString.emptyOrNullString(); }
@Test public void testGrammar() throws UnsupportedEncodingException { for (File swiftFile : swiftFiles) { ByteArrayOutputStream errContent = new ByteArrayOutputStream(); System.setErr(new PrintStream(errContent, false, Charset.defaultCharset().name())); String[] command = { "--debug", (TEST_INPUT_DIR + swiftFile.getName()) }; Tailor.main(command); assertThat(errContent.toString(Charset.defaultCharset().name()), IsEmptyString.isEmptyString()); System.setErr(null); } }
public void notEmpty() { verifyUsingMatcher(Matchers.not(IsEmptyString.isEmptyOrNullString())); } }
@Test public void matchesEmptyString() { assertMatches(emptyOrNullString(), ""); assertMatches(emptyString(), ""); }