public void testImageInTextDocument() {
try {
OdfTextDocument doc = OdfTextDocument.newTextDocument();
String imagePath1 = doc.newImage(ResourceUtilities.getURI("testA.jpg"));
Assert.assertTrue(getImageCount(doc) == 1);
OdfDrawImage image = getImageByPath(doc, imagePath1).get(0);
Assert.assertTrue(image.getImageUri().toString().equals(imagePath1));
OdfDrawFrame frame1 = (OdfDrawFrame) image.getParentNode();
frame1.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PAGE.toString());
frame1.setTextAnchorPageNumberAttribute(1);
//add paragraph
OfficeTextElement office = doc.getContentRoot();
OdfTextParagraph para1 = (OdfTextParagraph) office.newTextPElement();
para1.setTextContent("insert an image here");
String imagePath2 = doc.newImage(mImageUri_ODFDOM);
OdfTextParagraph para2 = (OdfTextParagraph) office.newTextPElement();
para2.setTextContent("another");
String imagePath3 = doc.newImage(mImageUri_ODFDOM);
OdfDrawImage image3 = getImageByPath(doc, imagePath3).get(1);
OdfDrawFrame frame3 = (OdfDrawFrame) image3.getParentNode();
frame3.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.CHAR.toString());
doc.save(ResourceUtilities.newTestOutputFile("addimages.odt"));
//load the file again