### Question:
Base64Encoder { public static byte[] getBytes(final String base64String) { final Base64 codec = new Base64(); final byte[] encodedBytes = StringEncoder.getBytes(base64String); if (!codec.isInAlphabet(encodedBytes, true)) { throw new IllegalArgumentException("malformed base64 string passed to getBytes"); } return codec.decode(encodedBytes); } private  Base64Encoder(); static byte[] getBytes(final String base64String); static String getString(final byte[] bytes);  }### Answer:
@Test public void stringCanBeConvertedToByteArray() { MatcherAssert.assertThat( Base64Encoder.getBytes("U2lnbWE="), IsEqual.equalTo(ENCODED_SIGMA_BYTES)); MatcherAssert.assertThat( Base64Encoder.getBytes("JMKi4oKs"), IsEqual.equalTo(ENCODED_CURRENCY_SYMBOLS_BYTES)); }
@Test public void malformedStringCannotBeDecoded() { Assertions.assertThrows( IllegalArgumentException.class, () -> Base64Encoder.getBytes("BAD STRING)(*&^%$#@!")); }
@Test public void stringCanContainPaddingAndWhitespace() { MatcherAssert.assertThat( Base64Encoder.getBytes(" U2lnbWE= "), IsEqual.equalTo(ENCODED_SIGMA_BYTES)); }