### Question:
Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } 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 shouldBeNull_whenDecodeNullString() { String input = null; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenDecodeNullByte() { byte[] input = null; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenDecodeInvalidString() { String input = "aGVsbG8=xxxx"; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeNull_whenDecodeInvalidByte() { byte[] input = "aGVsbG8=xxxx".getBytes(); String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeOk_whenDecodeHelloString() { String input = "aGVsbG8="; String output = Base64Utils.decode(input); String expected = "hello"; assertThat(output).isEqualTo(expected); }
@Test public void shouldBeOk_whenDecodeHelloByte() { byte[] input = "aGVsbG8=".getBytes(); String output = Base64Utils.decode(input); String expected = "hello"; assertThat(output).isEqualTo(expected); }