Buggy code:
public class MessageBodyExtractorTest { private static final Pattern MESSAGE_LOG_REGEX = Pattern . compile ( "^.*<seq2seq4repair_space>DEBUG<seq2seq4repair_space>c\\.g\\.s\\.mail\\.MailClientHandler:<seq2seq4repair_space>Message<seq2seq4repair_space>received<seq2seq4repair_space>\\[" ) ; public final void testAgainstFewerMessagesParsedThanExistError ( ) throws IOException { } @ Test public final void testAwkwardGmailEmailStream ( ) throws IOException , ParseException { } private void assertRfc822 ( Message message , String contentTransferEncoding ) { } private void assertMultipartRfc822 ( Message message ) { } private void assertRfc822withAttachment ( Message message ) { <START_BUG> assertEquals ( 3 , message . getBodyParts ( ) . size ( ) ) ; <END_BUG> Message . BodyPart part2 ; part2 = message . getBodyParts ( ) . get ( 1 ) ; assertNotNull ( part2 ) ; assertTrue ( Parsing . startsWithIgnoreCase ( part2 . getHeaders ( ) . get ( "Content-Type" ) . iterator ( ) . next ( ) , "message//rfc822" ) ) ; assertTrue ( Parsing . startsWithIgnoreCase ( part2 . getHeaders ( ) . get ( "Content-Transfer-Encoding" ) . iterator ( ) . next ( ) , "quoted-printable" ) ) ; assertNull ( part2 . getBody ( ) ) ; assertNull ( part2 . getBinBody ( ) ) ; assertEquals ( 1 , part2 . getBodyParts ( ) . size ( ) ) ; Message . BodyPart rfc822 = part2 . getBodyParts ( ) . get ( 0 ) ; assertNotNull ( rfc822 ) ; assertEquals ( rfc822 . getHeaders ( ) . size ( ) , 7 ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "Message-ID" ) . iterator ( ) . next ( ) , "<9632091.970.1320441146867.JavaMail.geo-discussion-forums@yqie15>" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "In-Reply-To" ) . iterator ( ) . next ( ) , "<AANLkTikNOzOVjj=mS8nFXoiuW=LPufKKsK_SOPEXdCby@mail.gmail.com>" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "X-Annoy" ) . iterator ( ) . next ( ) , "dhanji" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "From" ) . iterator ( ) . next ( ) , "example@example.com" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "To" ) . iterator ( ) . next ( ) , "example2@example.com" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "Subject" ) . iterator ( ) . next ( ) , "As<seq2seq4repair_space>basic<seq2seq4repair_space>as<seq2seq4repair_space>it<seq2seq4repair_space>gets" ) ; assertEquals ( rfc822 . getHeaders ( ) . get ( "Content-Type" ) . iterator ( ) . next ( ) , "multipart//mixed;<seq2seq4repair_space>boundary=e89a8ff1c384d8017504b42beb91" ) ; assertEquals ( 2 , rfc822 . getBodyParts ( ) . size ( ) ) ; Message . BodyPart sub1 = rfc822 . getBodyParts ( ) . get ( 0 ) ; Message . BodyPart sub2 = rfc822 . getBodyParts ( ) . get ( 1 ) ; assertEquals ( sub1 . getHeaders ( ) . get ( "Content-Type" ) . iterator ( ) . next ( ) , "text//plain;<seq2seq4repair_space>charset=ISO-8859-1" ) ; assertNotNull ( sub1 . getBody ( ) ) ; assertNull ( sub1 . getBinBody ( ) ) ; assertEquals ( sub2 . getHeaders ( ) . get ( "Content-Type" ) . iterator ( ) . next ( ) , "text//csv;<seq2seq4repair_space>charset=US-ASCII;<seq2seq4repair_space>name=\"csv-demo.csv\"" ) ; assertNull ( sub2 . getBody ( ) ) ; assertNotNull ( sub2 . getBinBody ( ) ) ; } private void assertComplexNestedStructure ( Message message ) { } private void assertNestedMultipart2LevelDeep ( Message message , String id , String boundary ) { } private static void assertHeaderEquals ( Multimap < String , String > headers , String header , String value ) { } @ Test public final void testTypicalGmailEmail ( ) throws IOException , ParseException { } @ Test public final void testReadUnfoldedHeaders ( ) throws IOException { } @ Test public final void testStartRegex ( ) { } @ Test public final void testEosRegex ( ) { } @ Test public final void testBoundaryExtractorRegex ( ) { } @ Test public final void testCharsetExtractorRegex ( ) { } }

Fix:
assertEquals ( message . getBodyParts ( ) . size ( ) , 3 ) ;