@Test public void testPreambleWithNoStartingBoundary() { String boundary = "boundary"; final byte[] chunk1 = (" \t \t\t \t \r\n" + "Content-Id: part1\n" + "\n" + "part1\n").getBytes(); MimeParser.ParsingException ex = assertThrows(MimeParser.ParsingException.class, () -> parse(boundary, chunk1)); assertThat(ex.getMessage(), is(equalTo("Missing start boundary"))); }
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);   }