@Test public void testEndMessageEvent() { String boundary = "boundary"; final byte[] chunk1 = ("--" + boundary + "\n" + "Content-Id: part1\n" + "\n" + "1\n" + "--" + boundary + "\n" + "Content-Id: part2\n" + "\n" + "2\n" + "--" + boundary + "--").getBytes(); MimeParser.ParserEvent lastEvent = parse(boundary, chunk1).lastEvent; assertThat(lastEvent, is(notNullValue())); assertThat(lastEvent.type(), is(equalTo(MimeParser.EventType.END_MESSAGE))); }
private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary); }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary);  }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary);   }