### Question:
CompressionUtils { static List<MantisServerSentEvent> tokenize(BufferedReader br) throws IOException { return tokenize(br, MANTIS_SSE_DELIMITER); }  static String compressAndBase64Encode(List<String> events, boolean useSnappy); static String compressAndBase64Encode(List<String> events, boolean useSnappy, byte[] delimiter); static String compressAndBase64Encode(List<String> events); static byte[] compressAndBase64EncodeBytes(List<List<byte[]>> nestedEvents, boolean useSnappy); static byte[] compressAndBase64EncodeBytes(List<List<byte[]>> nestedEvents, boolean useSnappy, byte[] delimiter); @Deprecated static byte[] compressAndBase64EncodeBytes(List<List<byte[]>> nestedEvents); static List<MantisServerSentEvent> decompressAndBase64Decode_old(String encodedString, boolean isCompressedBinary); static List<MantisServerSentEvent> decompressAndBase64Decode(String encodedString,
                                                                        boolean isCompressedBinary,
                                                                        boolean useSnappy); static List<MantisServerSentEvent> decompressAndBase64Decode(String encodedString,
                                                                        boolean isCompressedBinary,
                                                                        boolean useSnappy,
                                                                        String delimiter); @Deprecated static List<MantisServerSentEvent> decompressAndBase64Decode(String encodedString, boolean isCompressedBinary); static void main(String[] args); static final String MANTIS_SSE_DELIMITER; static final byte[] MANTIS_SSE_DELIMITER_BINARY; }### Answer:
@Test public void shouldTokenizeWithEventsContainingPartialDelimiterMatches() { String testInput = "ab$cdef$$$ghi$jkl$$$lmno$$pqrst$"; BufferedReader reader = new BufferedReader(new StringReader(testInput)); try { List<MantisServerSentEvent> result = CompressionUtils.tokenize(reader); assertEquals(result.size(), 3); assertEquals(result.get(0).getEventAsString(), "ab$cdef"); assertEquals(result.get(1).getEventAsString(), "ghi$jkl"); assertEquals(result.get(2).getEventAsString(), "lmno$$pqrst$"); } catch (IOException ex) { Assert.fail("Tokenization threw an IO exception that was unexpected"); } }
@Test public void shouldTokenizeWithEventsContainingPartialDelimiterMatchesWithCustomDelimiter() { String delimiter = UUID.randomUUID().toString(); String event1 = "ab" + delimiter.substring(0, 9) + "cdef"; String event2 = "ghi" + delimiter.substring(0, 5) + "jkl"; String event3 = "lmno" + delimiter.substring(0, 4) + "pqrst" + delimiter.substring(0, 2); String testInput = event1 + delimiter + event2 + delimiter + event3; BufferedReader reader = new BufferedReader(new StringReader(testInput)); try { List<MantisServerSentEvent> result = CompressionUtils.tokenize(reader, delimiter); assertEquals(result.size(), 3); assertEquals(result.get(0).getEventAsString(), event1); assertEquals(result.get(1).getEventAsString(), event2); assertEquals(result.get(2).getEventAsString(), event3); } catch (IOException ex) { Assert.fail("Tokenization threw an IO exception that was unexpected"); } }