Closed GoogleCodeExporter closed 8 years ago
Null and the empty string are not the same concept (despite what Oracle will
tell
you). This should not be called IsEmptyString.
Original comment by nat.pr...@gmail.com
on 21 Sep 2008 at 11:58
I like the idea, but not the name. My usecase is actually for the opposite
concept. I want to ensure that a string
"has content". This would be particularly useful for tests that expect
exceptions to be thrown with meaningful
messages. E.g.:
try {...} catch (NullPointerException e) { assertThat(e.getMessage(),
hasContent()); }
or written in the opposite form:
try {...} catch (NullPointerException e) { assertThat(e.getMessage(),
is(not(nullOrEmptyString()))); }
Original comment by gk5...@gmail.com
on 2 Oct 2008 at 4:24
My usecase was also to test that string is not empty, but than can be achieved
very
easily by: not(isEmptyString())
Original comment by jaroslav.kuruc
on 2 Oct 2008 at 4:38
A "postive" matcher, hasContents or something, would be better than a matcher
isEmptyString that has a misleaing name.
Original comment by nat.pr...@gmail.com
on 2 Oct 2008 at 8:17
so, the test for empty or null would be: not(hasContents())
personally, I suspect that a test for the empty case (whatever it's called) is
more common. Usually, if I want a
string to have a value, I'll want to say something about what's in it.
Original comment by smgfree...@gmail.com
on 2 Oct 2008 at 9:43
Original comment by nat.pr...@gmail.com
on 24 Oct 2008 at 12:32
Renamed IsNullOrEmptyString to IsEmptyString and adjusted matching as
appropriate. Added a
isEmptyOrNullString method that combines it with an IsNull matcher
Original comment by smgfree...@gmail.com
on 20 Nov 2008 at 8:34
Original comment by smgfree...@gmail.com
on 22 Nov 2008 at 12:16
Original issue reported on code.google.com by
jaroslav.kuruc
on 4 Sep 2008 at 10:01Attachments: