![]() (WordDocument.paragraph1), paragraphs.get(4).getText()) The verification of their styles is similar to what we have done with the title: assertEquals("from HTTP fundamentals to API Mastery",ĪssertEquals("What makes a good API?", paragraphs.get(3).getText()) ĪssertEquals(nvertTextFileToString XWPFRun titleRun = title.getRuns().get(0) ĪssertEquals("Build Your REST API with Spring", title.getText()) ĪssertEquals("009933", titleRun.getColor()) ĪssertEquals("Courier", titleRun.getFontFamily()) ĪssertEquals(20, titleRun.getFontSize()) įor the sake of simplicity, we just validate the contents of other parts of the file, leaving out the styles. Next, let's make sure that the content and style of the title is the same as what we have set before: XWPFParagraph title = paragraphs.get(0) List paragraphs = document.getParagraphs() XWPFDocument document = new XWPFDocument(Files.newInputStream(msWordPath)) First, we extract contents from the given MS Word file in the project directory and the store the contents in a List of XWPFParagraph: Path msWordPath = Paths.get(WordDocument.output)
0 Comments
Leave a Reply. |