@Test
public void testReplaceASingleImageReference() {

	List<MBAttachmentFileEntryReference> fileEntryReferences =
		new ArrayList<>();
	FileEntry fileEntry = Mockito.mock(FileEntry.class);
	long tempFileId = 1;
	String originalContent = String.format(
		"<img data-image-id=\"%d\" src=\"%s\"/>", tempFileId,
		"http://temporal");
	String finalURL = "http://final";
	Mockito.doReturn(
		finalURL
	).when(
		_portletFileRepository
	).getPortletFileEntryURL(
		Mockito.isNull(ThemeDisplay.class), Mockito.eq(fileEntry),
		Mockito.eq(StringPool.BLANK)
	);
	fileEntryReferences.add(
		new MBAttachmentFileEntryReference(tempFileId, fileEntry));
	String finalContent =
		_mbMessageHTMLFormatUploadHandler.replaceImageReferences(
			originalContent, fileEntryReferences);
	Assert.assertEquals("<img src=\"" + finalURL + "\" />", finalContent);
}