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