CLOUDSTACK-8660 - Adding new StringUtils.getDefaultCharset() in order to wrap the Charset equivalet method.

- This test was added in order to cover the new StringUtils.getDefaultCharset().
     - One cannot be sure that StringUtils.getPreferredCharset() will always be equals to Charset.defaultCharset()

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #616
This commit is contained in:
wilderrodrigues 2015-07-22 16:27:56 +02:00
parent 245c976ad0
commit d632d6312b
2 changed files with 9 additions and 1 deletions

View File

@ -52,6 +52,10 @@ public class StringUtils {
return Charset.isSupported(UTF8);
}
public static Charset getDefaultCharset() {
return Charset.defaultCharset();
}
public static String join(final Iterable<? extends Object> iterable, final String delim) {
final StringBuilder sb = new StringBuilder();
if (iterable != null) {

View File

@ -42,7 +42,11 @@ public class StringUtilsTest {
@Test
public void testGetDefaultCharset() {
assertEquals(StringUtils.getPreferredCharset(), Charset.defaultCharset());
// Is this test irrelevant? Is wrapping the Charset.defaultCharset() too much?
// This test was added in order to cover the new StringUtils.getDefaultCharset().
// One cannot be sure that StringUtils.getPreferredCharset() will always be
// equals to Charset.defaultCharset()
assertEquals(StringUtils.getDefaultCharset(), Charset.defaultCharset());
}
@Test