blip.all().delete();
blip.append(new Image(url, 100, 100, "Cool pix."));
blip.append(" some piece of text.");
assertEquals("\n some piece of text.", blip.getContent());
assertEquals(url, ((Image) blip.first(ElementType.IMAGE).value()).getUrl());
blip.first(ElementType.IMAGE).insertAfter(new BlipContentFunction() {
@Override
public BlipContent call(BlipContent source) {
Image matchedImage = (Image) source;
return Plaintext.of(matchedImage.getUrl());
}
});
assertEquals("\n " + url + " some piece of text.", blip.getContent());
blip.all().delete();
blip.append(new Image(url, 100, 100, "Cool pix."));
blip.append(" some piece of text.");
assertEquals("\n some piece of text.", blip.getContent());
assertEquals(url, ((Image) blip.first(ElementType.IMAGE).value()).getUrl());
blip.first(ElementType.IMAGE).replace(new BlipContentFunction() {
@Override
public BlipContent call(BlipContent source) {
Image matchedImage = (Image) source;
return new Image(matchedImage.getUrl() + "?query=foo", matchedImage.getWidth(),
matchedImage.getHeight(), matchedImage.getCaption());