### Question:
FolderNameCodec { public String decode(String encodedFolderName) throws CharacterCodingException { CharsetDecoder decoder = modifiedUtf7Charset.newDecoder().onMalformedInput(CodingErrorAction.REPORT); ByteBuffer byteBuffer = ByteBuffer.wrap(encodedFolderName.getBytes(asciiCharset)); CharBuffer charBuffer = decoder.decode(byteBuffer); return charBuffer.toString(); } private  FolderNameCodec(); static FolderNameCodec newInstance(); String encode(String folderName); String decode(String encodedFolderName);  }### Answer:
@Test public void decode_withEncodedArgument_shouldReturnDecodedString() throws Exception { String encodedFolderName = "&ANw-bergr&APYA3w-entr&AOQ-ger"; String result = folderNameCode.decode(encodedFolderName); assertEquals("Übergrößenträger", result); }
@Test public void decode_withInvalidEncodedArgument_shouldThrow() throws Exception { String encodedFolderName = "&12-foo"; try { folderNameCode.decode(encodedFolderName); fail("Expected exception"); } catch (CharacterCodingException ignored) { } }