@Test public void testLetUsMakeCloverHappy() throws Exception { final QCodec qcodec = new QCodec(); qcodec.setEncodeBlanks(true); assertTrue(qcodec.isEncodeBlanks()); qcodec.setEncodeBlanks(false); assertFalse(qcodec.isEncodeBlanks()); }
@Test public void testEncodeDecodeBlanks() throws Exception { final String plain = "Mind those pesky blanks"; final String encoded1 = "=?UTF-8?Q?Mind those pesky blanks?="; final String encoded2 = "=?UTF-8?Q?Mind_those_pesky_blanks?="; final QCodec qcodec = new QCodec(); qcodec.setEncodeBlanks(false); String s = qcodec.encode(plain); assertEquals("Blanks encoding with the Q codec test", encoded1, s); qcodec.setEncodeBlanks(true); s = qcodec.encode(plain); assertEquals("Blanks encoding with the Q codec test", encoded2, s); s = qcodec.decode(encoded1); assertEquals("Blanks decoding with the Q codec test", plain, s); s = qcodec.decode(encoded2); assertEquals("Blanks decoding with the Q codec test", plain, s); }