/** Created Breaklines according to the number of times provided. * @param value number of times * @return the Breakline object ready to go! */ public static BreakLine times(final Integer value) { return new BreakLine(value); }
@Override public final String getContent() { StringBuilder res = new StringBuilder(""); applyBreakLineTimes(res); return res.toString(); }
@Test public void testBreakNumberConstructor() { BreakLine br = new BreakLine(1); assertEquals( "\n<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>", br.getContent()); int tot = TestUtils .regexCount(br.getContent(), "(<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>)"); assertEquals(1, tot); }
@Test public void testBreakTimes() { BreakLine br = BreakLine.times(3).create(); int tot = TestUtils .regexCount(br.getContent(), "(<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>)"); assertEquals(3, tot); }
myDoc.addEle(BreakLine.times(1).create()); // this is one breakline .with("This doc has been generated by the unit test testJava2wordAllInOne() in the class DocumentTest2004Test.java.") .create()); myDoc.addEle(BreakLine.times(1).create()); myDoc.addEle(BreakLine.times(1).create()); ParagraphPiece myParPiece01 = ParagraphPiece .with("If you use the class 'Paragraph', you will have limited style. Maybe only paragraph Aligment or BgColor."); myDoc.addEle(BreakLine.times(2).create()); myDoc.addEle(Paragraph.withPieces( ParagraphPiece.with("This is a manual 'bold' and 'italic'") .withStyle().font(Font.COURIER_BOLD_ITALIC) .create()).create()); myDoc.addEle(BreakLine.times(1).create()); myDoc.addEle(BreakLine.times(1).create()); myDoc.addEle(Paragraph.withPieces(ParagraphPiece.with("New ParagraphPiece styles have been implemented. Here they are:").withStyle().fontSize("14").create())); myDoc.addEle(Paragraph.withPieces(ParagraphPiece.with("The Style is: ").create(), ParagraphPiece.with("Outline").withStyle().outline().create())); myDoc.addEle(Paragraph.withPieces(ParagraphPiece.with("The Style is: ").create(), ParagraphPiece.with("Shadow").withStyle().shadow().create())); myDoc.addEle(BreakLine.times(2).create()); myDoc.addEle(BreakLine.times(2).create()); myDoc.addEle(Heading2.with("===== Document Header and Footer ======") .create());
@Test public void testBreakDefaultTest() { BreakLine br = new BreakLine(); assertEquals( "\n<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>", br.getContent()); int tot = TestUtils .regexCount(br.getContent(), "(<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>)"); assertEquals(1, tot); }
@Test public void testBreakNumberConstructor02() { BreakLine br02 = new BreakLine(2); int tot = TestUtils .regexCount(br02.getContent(), "(<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>)"); assertEquals(2, tot); BreakLine br04 = new BreakLine(4); assertEquals( TestUtils .regexCount(br04.getContent(), "(<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>)"), 4); }
/** Created Breaklines according to the number of times provided. * @param value number of times * @return the Breakline object ready to go! */ public static BreakLine times(final Integer value) { return new BreakLine(value); }
@Override public final String getContent() { StringBuilder res = new StringBuilder(""); applyBreakLineTimes(res); return res.toString(); }