Source:
public void generatesExpectedMessageForLongComment ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.author = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockEvent.comment = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + ( ( "Integer tristique ligula nec dapibus lobortis. Nulla venenatis, lacus quis vulputate volutpat, " + "sem neque ornare eros, vel sodales magna risus et diam. Maecenas ultricies justo dictum orci " ) + "scelerisque consequat a vel purus." ) ; mockChange.number = 1234 ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockChange.owner = mockOwner ; mockOwner.name = "Owner" ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = ( ( ( ( ( ( ( ( ( ( ( ( "{\n" + ( ( ( " \"channel\": \"#testchannel\",\n" + " \"attachments\": [\n" ) + " {\n" ) + " \"fallback\": \"Unit Tester commented on - testproject (master) - https://change/ - " ) ) + ( mockEvent.comment.substring ( 0 , 197 ) ) ) + "...\",\n" ) + " \"pretext\": \"Unit Tester commented on\",\n" ) + " \"title\": \"testproject (master) - change 1234\",\n" ) + " \"title_link\": \"https://change/\",\n" ) + " \"text\": \"" ) + ( mockEvent.comment.substring ( 0 , 197 ) ) ) + "...\",\n" ) + " \"color\": \"good\"\n" ) + " }\n" ) + " ]\n" ) + "}\n" ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }

Target:
public void generatesExpectedMessage ( ) throws java.lang.Exception { com.cisco.gerrit.plugins.slack.config.ProjectConfig config = getConfig ( ) ; mockEvent.change = com.google.common.base.Suppliers.ofInstance ( mockChange ) ; mockEvent.author = com.google.common.base.Suppliers.ofInstance ( mockAccount ) ; mockEvent.comment = "This is the comment body." ; mockChange.number = 1234 ; mockChange.project = "testproject" ; mockChange.branch = "master" ; mockChange.url = "https://change/" ; mockChange.owner = mockOwner ; mockOwner.name = "Owner" ; mockChange.commitMessage = "This is the title\nThis is the message body." ; mockAccount.name = "Unit Tester" ; com.cisco.gerrit.plugins.slack.message.MessageGenerator messageGenerator ; messageGenerator = com.cisco.gerrit.plugins.slack.message.MessageGeneratorFactory.newInstance ( mockEvent , config ) ; java.lang.String expectedResult ; expectedResult = "{\n" + ( ( ( ( ( ( ( ( ( ( ( " \"channel\": \"#testchannel\",\n" + " \"attachments\": [\n" ) + " {\n" ) + " \"fallback\": \"Unit Tester commented on testproject (master) https://change/: This is the title\",\n" ) + " \"pretext\": \"Unit Tester commented on <https://change/|testproject (master) change 1234>\",\n" ) + " \"title\": \"This is the title\",\n" ) + " \"title_link\": \"https://change/\",\n" ) + " \"text\": \"This is the comment body.\",\n" ) + " \"color\": \"good\"\n" ) + " }\n" ) + " ]\n" ) + "}\n" ) ; java.lang.String actualResult ; actualResult = messageGenerator.generate ( ) ; org.junit.Assert.assertThat ( actualResult , org.hamcrest.core.Is.is ( org.hamcrest.CoreMatchers.equalTo ( expectedResult ) ) ) ; }