HexString { @Nonnull public static String getHexString(@Nonnull final String textValue) { assert textValue != null; assert !textValue.isEmpty(); return getHexString(textValue.getBytes()); } private  HexString(); @Nonnull static String getHexString(@Nonnull final String textValue); @Nonnull static String getHexString(@Nonnull final byte[] bytes); @Nonnull static byte[] getHexByteArray(@Nonnull final String hexValue);  }
@Test public void testHexStringString() { LOG.info("testHexStringString"); Assert.assertEquals("41", HexString.getHexString("A")); Assert.assertEquals("4142", HexString.getHexString("AB")); }
@Test public void testEmptyArray() { LOG.info("testEmptyArray"); try { final byte[] emptyArray = new byte[0]; HexString.getHexString(emptyArray); } catch (final AssertionError ignored) { return; } Assert.fail("Wrong: null accepted by @Nonnull parameters!"); }
@Test public void testEmptyString() { LOG.info("testEmptyString"); try { final String nullString = ""; HexString.getHexString(nullString); } catch (final AssertionError ignored) { return; } Assert.fail("Wrong: null accepted by @Nonnull parameters!"); }
@Test public void testNullBytesArray() { LOG.info("testNullBytesArray"); try { final byte[] nullArray = null; HexString.getHexString(nullArray); } catch (final AssertionError | IllegalArgumentException ignored) { return; } Assert.fail("Wrong: null accepted by @Nonnull parameters!"); }
@Test public void testNullString() { LOG.info("testNullString"); try { final String nullString = null; HexString.getHexString(nullString); } catch (final AssertionError | IllegalArgumentException ignored) { return; } Assert.fail("Wrong: null accepted by @Nonnull parameters!"); }