Hi,
Why do you have to work with files? If I were you
I'd work with
content in memory, not files. That's much better because:
I load the files into memory :)
1/ The test and the input data are in the same location making it
easier to understand and maintain the test
Adding about 150 lines (html and xwiki) makes the test file very very
big. I have here
laying much bigger html files (400 lines because of the <style> stuff)
and I dont
want to add them.
2/ No IO thus less complex (your post proves it)
But is very hard to add 150 lines of a String to the source. Have a look at:
html = "<table border=1 cellspacing=0 cellpadding=0
style='border-collapse:collapse;"
+ "border:none;mso-border-alt:solid windowtext
.5pt;mso-padding-alt:0cm 3.5pt 0cm 3.5pt'>"
+ " <tr>"
+ " <td width=179 valign=top
style='width:107.15pt;border:solid windowtext .5pt;"
+ " padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=MsoNormal
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE style='color:black;"
+ " layout-grid-mode:line'>Date
<o:p></o:p></span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border:solid windowtext .5pt;"
+ " border-left:none;mso-border-left-alt:solid
windowtext .5pt;padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=MsoNormal
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE style='color:black;"
+ "
layout-grid-mode:line'>Version<o:p></o:p></span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border:solid windowtext .5pt;"
+ " border-left:none;mso-border-left-alt:solid
windowtext .5pt;padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=MsoNormal
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE style='color:black;"
+ "
layout-grid-mode:line'>Description<o:p></o:p></span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border:solid windowtext .5pt;"
+ " border-left:none;mso-border-left-alt:solid
windowtext .5pt;padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=MsoNormal
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE style='color:black;"
+ "
layout-grid-mode:line'>Author<o:p></o:p></span></p>"
+ " </td>"
+ " </tr>"
+ "<tr>"
+ " <td width=179 valign=top
style='width:107.15pt;border:solid windowtext .5pt;"
+ " border-top:none;mso-border-top-alt:solid windowtext
.5pt;padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=ProjektStandard
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE>09.04.2006</span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border-top:none;border-left:"
+ " none;border-bottom:solid windowtext
.5pt;border-right:solid windowtext .5pt;"
+ " mso-border-top-alt:solid windowtext
.5pt;mso-border-left-alt:solid windowtext .5pt;"
+ " padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=ProjektStandard
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE>1.0</span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border-top:none;border-left:v"
+ " none;border-bottom:solid windowtext
.5pt;border-right:solid windowtext .5pt;"
+ " mso-border-top-alt:solid windowtext
.5pt;mso-border-left-alt:solid windowtext .5pt;"
+ " padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=ProjektStandard
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE>Bla</span></p>"
+ " </td>"
+ " <td width=179 valign=top
style='width:107.2pt;border-top:none;border-left:"
+ " none;border-bottom:solid windowtext
.5pt;border-right:solid windowtext .5pt;"
+ " mso-border-top-alt:solid windowtext
.5pt;mso-border-left-alt:solid windowtext .5pt;"
+ " padding:0cm 3.5pt 0cm 3.5pt'>"
+ " <p class=MsoNormal
style='margin-top:3.0pt;margin-right:0cm;margin-bottom:"
+ " 3.0pt;margin-left:0cm;line-height:150%'><span
lang=DE style='color:black;"
+ "
layout-grid-mode:line'>Christian<o:p></o:p></span></p>"
+ " </td>"
+ " </tr>"
+ "</table>";
Doing copy and paste in a file is much easier to handle...
3/ Much faster
For me its no problem if the test is a little bit slower... the quality of tests
are much important.
Greets,
Christian