### Question:
Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private  Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data);  }### Answer:
@Test public void shouldBeOk_whenEncodeHelloString() { String input = "hello"; String output = Base64Utils.encode(input); String expected = "aGVsbG8="; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeOk_whenEncodeHelloByte() { byte[] input = "hello".getBytes(); String output = Base64Utils.encode(input); String expected = "aGVsbG8="; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenEncodeNullString() { String input = null; String output = Base64Utils.encode(input); String expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenEncodeNullByte() { byte[] input = null; String output = Base64Utils.encode(input); String expected = null; assertThat(output).isEqualTo(expected); }