Asserting that a string
is not empty in junit can be done in the following ways:
assertTrue(!string.isEmpty());
assertFalse(string.isEmpty());
assertThat(string.toCharArray(), is(not(emptyArray())); // (although this didn't compile)
My question is: is there a better way of checking this - something like:
assertThat(string, is(not(empty()))
?
IsEmptyString
– LandauassertThat(string.isEmpty(), is(false))
– Landau