### Question:
MacEncoder extends BaseEncoder { public MacEncoder useBase64(boolean useBase64) { this.useBase64 = useBase64; return this; } MacEncoder(String algorithm, String secret);  MacEncoder(String algorithm, byte[] secret); MacEncoder useBase64(boolean useBase64);  }### Answer:
@Test public void t0() { String algorithm = "HmacSHA256"; String secret = "123xcef"; String source = "123456qweasd"; MacEncoder encoder = new MacEncoder(algorithm, secret); String result = encoder.encode(source); Assert.assertEquals("fafea2c76d82df6d21edb318754afe57f25a62b05ad4fa9f427a0b4cb9b498d7", result); result = encoder.useBase64(true).encode(source); Assert.assertEquals("+v6ix22C320h7bMYdUr+V/JaYrBa1PqfQnoLTLm0mNc=", result); }