Buggy code:
public class BugsTest { private static final Logger LOGGER = LoggerFactory . getLogger ( BugsTest . class ) ; @ Test public void notificationUrlEscapingTest_bug42 ( ) { String templ = "Dear<seq2seq4repair_space>XXX_USER_NAME_XXX,\\r\\n\\r\\nThe<seq2seq4repair_space>zipped<seq2seq4repair_space>items<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>downloaded<seq2seq4repair_space>by<seq2seq4repair_space>user<seq2seq4repair_space>\"XXX_ACTOR_NAME_XXX\":<seq2seq4repair_space>XXX_ACTOR_EMAIL_XXX\\r\\nat<seq2seq4repair_space>XXX_TIME_XXX.\\r\\nXXX_ITEMS_DOWNLOADED_XXX\\r\\n\\r\\nThe<seq2seq4repair_space>items<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>found<seq2seq4repair_space>by<seq2seq4repair_space>query:<seq2seq4repair_space>XXX_QUERY_URL_XXX\\r\\n\\r\\nWARNING:<seq2seq4repair_space>This<seq2seq4repair_space>is<seq2seq4repair_space>an<seq2seq4repair_space>automatically<seq2seq4repair_space>generated<seq2seq4repair_space>email,<seq2seq4repair_space>please<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>reply!" ; String url = "http:////dev-faces.mpdl.mpg.de//imeji//collection//SoL9eg21DU7tlwAg//browse?q=" + ( "NOTstatement==\"http:////dev-faces.mpdl.mpg.de//imeji//statement//UkSj3SDNS0DYMvDA\"<seq2seq4repair_space>" + "NOT<seq2seq4repair_space>AND<seq2seq4repair_space>statement==\"http:////dev-faces.mpdl.mpg.de//imeji//statement//G0rE6dg5KMTLLVIe" ) ; String expected = "Dear<seq2seq4repair_space>User<seq2seq4repair_space>Name,\\r\\n\\r\\nThe<seq2seq4repair_space>zipped<seq2seq4repair_space>items<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>downloaded<seq2seq4repair_space>by<seq2seq4repair_space>user<seq2seq4repair_space>\"non_logged_in_user\":<seq2seq4repair_space>\\r\\nat<seq2seq4repair_space>Tue<seq2seq4repair_space>Mar<seq2seq4repair_space>24<seq2seq4repair_space>17:44:40<seq2seq4repair_space>CET<seq2seq4repair_space>2015.\\r\\nhttp:////dev-faces.mpdl.mpg.de//imeji//collection//SoL9eg21DU7tlwAg//browse?q=NOTstatement==%22http:////dev-faces.mpdl.mpg.de//imeji//statement//UkSj3SDNS0DYMvDA%22%20NOT%20AND%20statement==%22http:////dev-faces.mpdl.mpg.de//imeji//statement//G0rE6dg5KMTLLVIe\\r\\n\\r\\nThe<seq2seq4repair_space>items<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>found<seq2seq4repair_space>by<seq2seq4repair_space>query:<seq2seq4repair_space>http:////dev-faces.mpdl.mpg.de//imeji//collection//SoL9eg21DU7tlwAg//browse?q=NOTstatement==%22http:////dev-faces.mpdl.mpg.de//imeji//statement//UkSj3SDNS0DYMvDA%22%20NOT%20AND%20statement==%22http:////dev-faces.mpdl.mpg.de//imeji//statement//G0rE6dg5KMTLLVIe\\r\\n\\r\\nWARNING:<seq2seq4repair_space>This<seq2seq4repair_space>is<seq2seq4repair_space>an<seq2seq4repair_space>automatically<seq2seq4repair_space>generated<seq2seq4repair_space>email,<seq2seq4repair_space>please<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>reply!" ; SessionBean mockedSession = mock ( SessionBean . class ) ; when ( mockedSession . getMessage ( "email_zip_images_downloaded_body" ) ) . thenReturn ( templ ) ; when ( mockedSession . getMessage ( "collection" ) ) . thenReturn ( "Collection" ) ; when ( mockedSession . getMessage ( "filtered" ) ) . thenReturn ( "filtered" ) ; when ( mockedSession . getMessage ( "items_count" ) ) . thenReturn ( "items<seq2seq4repair_space>count" ) ; User mockedToUser = mock ( User . class ) ; when ( mockedToUser . getName ( ) ) . thenReturn ( "User<seq2seq4repair_space>Name" ) ; EmailMessages em = new EmailMessages ( ) ; <START_BUG> assertThat ( em . getEmailOnZipDownload_Body ( mockedToUser , null , UrlHelper . encodeQuery ( url ) , url , mockedSession ) . replaceAll ( "at.*CET" , "" ) , equalTo ( expected . replaceAll ( "at.*CET" , "" ) ) ) ; <END_BUG> } }

Fix:
assertThat ( em . getEmailOnZipDownload_Body ( mockedToUser , null , UrlHelper . encodeQuery ( url ) , url , mockedSession ) . replaceAll ( "at.*\\d{4}\\." , "" ) , equalTo ( expected . replaceAll ( "at.*\\d{4}\\." , "" ) ) ) ;