@Test
public void base64Encode() throws IOException {

    DigestOutputStream digestOutputStream =
            StreamHelper.createMd5MessageOutputStream(new StreamHelper.NullOutputStream());
    assertEquals(
            "1B2M2Y8AsgTpgAmY7PhCfg==",
            StreamHelper.base64Encode(digestOutputStream.getMessageDigest()));
    digestOutputStream.write(TEST_STR.getBytes());
    assertEquals(
            "w/zT12GS5AB9+0lsymfhOw==",
            StreamHelper.base64Encode(digestOutputStream.getMessageDigest()));
    // digest reset
    assertEquals(
            "1B2M2Y8AsgTpgAmY7PhCfg==",
            StreamHelper.base64Encode(digestOutputStream.getMessageDigest()));
}