@Test public void reemplazarConRutaInvalida() { String html = "<html><body><img id='img' src=\"http://www.marcelomingrone.com.ar/INVALIDO/2014-01-01/imgA.jpg\" " + "width='123' height='321' border='0' /></body></html>"; Document document = Jsoup.parse(html); servicio.reemplazarImagenesContenido(document, imagenes); String urlImagen = document.getElementById("img").attr("src"); assertEquals("http://www.marcelomingrone.com.ar/INVALIDO/2014-01-01/imgA.jpg", urlImagen); assertEquals(0, imagenes.size()); }
@Test public void reemplazarUnaImagenContenido() { String html = "<html><body><img id='img' src=\"http://www.marcelomingrone.com.ar/newsletter/2014-01-01/imgA.jpg\" " + "width='123' height='321' border='0' /></body></html>"; Document document = Jsoup.parse(html); servicio.reemplazarImagenesContenido(document, imagenes); String nuevaUrlImagen = document.getElementById("img").attr("src"); assertEquals("cid:" + IMG_PREFIX + "2014-01-01_imgA.jpg", nuevaUrlImagen); assertEquals(1, imagenes.size()); assertEquals( NEWSLETTER_HOME + "/2014-01-01/imgA.jpg", imagenes.get(IMG_PREFIX + "2014-01-01_imgA.jpg")); }