By
using isEmptyString method, you can create a matcher that matches when the
examined string has zero length.
Ex
String
str = "";
assertThat("str
should be empty", str, isEmptyString());
Find
the below working application.
TestApp.java
package com.sample.model; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.isEmptyString; import org.junit.Test; public class TestApp { @Test public void testmethod() { String str = ""; assertThat("str should be empty", str, isEmptyString()); } }
No comments:
Post a Comment