1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.rat.annotation;
20
21 import org.apache.commons.io.IOUtils;
22 import org.apache.rat.test.utils.Resources;
23 import org.junit.ClassRule;
24 import org.junit.Test;
25 import org.junit.rules.TemporaryFolder;
26
27 import java.io.BufferedReader;
28 import java.io.File;
29 import java.io.FileReader;
30 import java.io.FileWriter;
31 import java.io.IOException;
32 import java.io.Writer;
33
34 import static org.junit.Assert.assertEquals;
35 import static org.junit.Assert.assertFalse;
36
37 public class TestLicenseAppender {
38 @ClassRule
39 public static TemporaryFolder baseTempFolder = new TemporaryFolder();
40
41 private static final String FIRST_LICENSE_LINE = " Licensed to the Apache Software Foundation (ASF) under one";
42
43 private interface FileCreator {
44 void createFile(Writer w) throws IOException;
45 }
46
47 private interface NewFileReader {
48 void readFile(BufferedReader r) throws IOException;
49 }
50
51 private static String getTemporaryFileWithName(String fileName) throws IOException {
52 if (fileName != null) {
53 return baseTempFolder.newFile(fileName).getAbsolutePath();
54 } else {
55 return baseTempFolder.newFile().getAbsolutePath();
56 }
57 }
58
59 private static void createTestFile(String fileName,
60 FileCreator creator)
61 throws IOException {
62 FileWriter w = null;
63 try {
64 creator.createFile(w = new FileWriter(fileName));
65 } finally {
66 IOUtils.closeQuietly(w);
67 }
68 }
69
70 private static void tryToDelete(File f) {
71 if (f != null && f.exists() && !f.delete()) {
72 f.deleteOnExit();
73 }
74 }
75
76 private static void commonTestTemplate(String relativeName,
77 FileCreator creator,
78 NewFileReader reader)
79 throws IOException {
80 String name = getTemporaryFileWithName(relativeName);
81 try {
82 createTestFile(name, creator);
83
84 ApacheV2LicenseAppender appender =
85 new ApacheV2LicenseAppender();
86 appender.append(new File(name));
87
88 BufferedReader r = null;
89 try {
90 r = new BufferedReader(new FileReader(name + ".new"));
91 reader.readFile(r);
92 } finally {
93 IOUtils.closeQuietly(r);
94 }
95 } finally {
96 tryToDelete(new File(name));
97 tryToDelete(new File(name + ".new"));
98 }
99 }
100
101 private static NewFileReader checkLines(final String firstLine,
102 final String secondLine) {
103 return new NewFileReader() {
104 public void readFile(BufferedReader r) throws IOException {
105 String line = r.readLine();
106 assertEquals("First line is incorrect",
107 firstLine, line);
108 if (secondLine != null) {
109 line = r.readLine();
110 assertEquals("Second line is incorrect",
111 secondLine, line);
112 }
113 }
114 };
115 }
116
117 private static NewFileReader checkLines(final String firstLine,
118 final String secondLine,
119 final String thirdLine) {
120 return new NewFileReader() {
121 public void readFile(BufferedReader r) throws IOException {
122 String line = r.readLine();
123 assertEquals("First line is incorrect",
124 firstLine, line);
125 if (secondLine != null) {
126 line = r.readLine();
127 assertEquals("Second line is incorrect",
128 secondLine, line);
129 }
130 if (thirdLine != null) {
131 line = r.readLine();
132 assertEquals("Third line is incorrect",
133 thirdLine, line);
134 }
135 }
136 };
137 }
138
139 @Test
140 public void addLicenseToUnknownFile() throws IOException {
141 String filename = getTemporaryFileWithName(null);
142 createTestFile(filename, new FileCreator() {
143 public void createFile(Writer writer)
144 throws IOException {
145 writer.write("Unknown file type\n");
146 }
147 });
148
149 File file = new File(filename);
150 file.deleteOnExit();
151 ApacheV2LicenseAppender appender =
152 new ApacheV2LicenseAppender();
153 appender.append(file);
154
155 File newFile = new File(filename + ".new");
156 newFile.deleteOnExit();
157 assertFalse("No new file should have been written",
158 newFile.exists());
159 }
160
161 @Test
162 public void addLicenseToJava() throws IOException {
163 String filename = "tmp.java";
164 final String firstLine = "package foo;";
165 final String secondLine = "";
166 final String thirdLine = "/*";
167 commonTestTemplate(filename, new FileCreator() {
168 public void createFile(Writer writer)
169 throws IOException {
170 writer.write(firstLine + "\n");
171 writer.write("\n");
172 writer.write("public class test {\n");
173 writer.write("}\n");
174 }
175 },
176 checkLines(firstLine, secondLine, thirdLine));
177 }
178
179 @Test
180 public void addLicenseToJavaWithoutPackage() throws IOException {
181 String filename = "tmp.java";
182 String commentLine = "/*";
183 commonTestTemplate(filename, new FileCreator() {
184 public void createFile(Writer writer)
185 throws IOException {
186 writer.write("public class test {\n");
187 writer.write("}\n");
188 }
189 },
190 checkLines(commentLine, null));
191 }
192
193 @Test
194 public void addLicenseToXML() throws IOException {
195 String filename = "tmp.xml";
196 final String firstLine = "<?xml version='1.0'?>";
197 final String secondLine = "";
198 final String thirdLine = "<!--";
199
200 commonTestTemplate(filename, new FileCreator() {
201 public void createFile(Writer writer)
202 throws IOException {
203 writer.write(firstLine + "\n");
204 writer.write("\n");
205 writer.write("<xml>\n");
206 writer.write("</xml>\n");
207 }
208 },
209 checkLines(firstLine, secondLine, thirdLine));
210 }
211
212 @Test
213 public void addLicenseToXMLWithoutDecl() throws IOException {
214 String filename = "tmp.xml";
215 final String firstLine = "<?xml version='1.0'?>";
216 final String secondLine = "<!--";
217
218 commonTestTemplate(filename, new FileCreator() {
219 public void createFile(Writer writer)
220 throws IOException {
221 writer.write("<xml>\n");
222 writer.write("</xml>\n");
223 }
224 },
225 checkLines(firstLine, secondLine));
226 }
227
228 @Test
229 public void addLicenseToHTML() throws IOException {
230 String filename = "tmp.html";
231 String commentLine = "<!--";
232
233 commonTestTemplate(filename, new FileCreator() {
234 public void createFile(Writer writer)
235 throws IOException {
236 writer.write("<html>\n");
237 writer.write("\n");
238 writer.write("</html>\n");
239 }
240 },
241 checkLines(commentLine, null));
242 }
243
244 @Test
245 public void addLicenseToCSS() throws IOException {
246 String filename = "tmp.css";
247 String firstLine = "/*";
248
249 commonTestTemplate(filename, new FileCreator() {
250 public void createFile(Writer writer)
251 throws IOException {
252 writer.write(".class {\n");
253 writer.write(" background-color: red;");
254 writer.write("}\n");
255 }
256 },
257 checkLines(firstLine, null));
258 }
259
260 @Test
261 public void addLicenseToJavascript() throws IOException {
262 String filename = "tmp.js";
263 String firstLine = "/*";
264
265 commonTestTemplate(filename, new FileCreator() {
266 public void createFile(Writer writer)
267 throws IOException {
268 writer.write("if (a ==b) {>\n");
269 writer.write(" alert(\"how useful!\");");
270 writer.write("}\n");
271 }
272 },
273 checkLines(firstLine, null));
274 }
275
276 @Test
277 public void addLicenseToAPT() throws IOException {
278 String filename = "tmp.apt";
279 String firstLine = "~~" + FIRST_LICENSE_LINE;
280
281 commonTestTemplate(filename, new FileCreator() {
282 public void createFile(Writer writer)
283 throws IOException {
284 writer.write("A Simple APT file");
285 writer.write(" This file contains nothing\n");
286 writer.write(" of any importance\n");
287 }
288 },
289 checkLines(firstLine, null));
290 }
291
292 @Test
293 public void addLicenseToProperties() throws IOException {
294 String filename = "tmp.properties";
295 String firstLine = "#" + FIRST_LICENSE_LINE;
296
297 commonTestTemplate(filename, new FileCreator() {
298 public void createFile(Writer writer)
299 throws IOException {
300 writer.write("property = value\n");
301 writer.write("fun = true\n");
302 writer.write("cool = true\n");
303 }
304 },
305 checkLines(firstLine, null));
306 }
307
308 @Test
309 public void addLicenseToScala() throws IOException {
310 String filename = "tmp.scala";
311 final String firstLine = "package foo {";
312 final String newFirstLine = "/*";
313
314 commonTestTemplate(filename, new FileCreator() {
315 public void createFile(Writer writer)
316 throws IOException {
317 writer.write(firstLine + "\n");
318 writer.write("\n");
319 writer.write(" object X { val x = 1; }\n");
320 writer.write("}\n");
321 }
322 },
323 new NewFileReader() {
324 public void readFile(BufferedReader reader)
325 throws IOException {
326 String line = reader.readLine();
327 assertEquals("First line is incorrect",
328 newFirstLine, line);
329 while ((line = reader.readLine()) != null) {
330 if (line.length() == 0) {
331 line = reader.readLine();
332 break;
333 }
334 }
335 assertEquals("Package line is incorrect",
336 firstLine, line);
337 }
338 });
339 }
340
341 @Test
342 public void addLicenseToRubyWithoutHashBang()
343 throws IOException {
344 String filename = "tmp.rb";
345 String firstLine = "#" + FIRST_LICENSE_LINE;
346
347 commonTestTemplate(filename, new FileCreator() {
348 public void createFile(Writer writer)
349 throws IOException {
350 writer.write("class Foo\n");
351 writer.write("end\n");
352 }
353 },
354 checkLines(firstLine, null));
355 }
356
357 @Test
358 public void addLicenseToRubyWithHashBang() throws IOException {
359 String filename = "tmp.rb";
360 final String firstLine = "#!/usr/bin/env ruby";
361 String secondLine = "#" + FIRST_LICENSE_LINE;
362
363 commonTestTemplate(filename, new FileCreator() {
364 public void createFile(Writer writer)
365 throws IOException {
366 writer.write(firstLine + "\n");
367 writer.write("class Foo\n");
368 writer.write("end\n");
369 }
370 },
371 checkLines(firstLine, secondLine));
372 }
373
374 @Test
375 public void addLicenseToPerlWithoutHashBang()
376 throws IOException {
377 String filename = "tmp.pl";
378 String firstLine = "#" + FIRST_LICENSE_LINE;
379
380 commonTestTemplate(filename, new FileCreator() {
381 public void createFile(Writer writer)
382 throws IOException {
383 writer.write("print \"Hello world\"\n");
384 }
385 },
386 checkLines(firstLine, null));
387 }
388
389 @Test
390 public void addLicenseToPerlWithHashBang() throws IOException {
391 String filename = "tmp.pl";
392 final String firstLine = "#!/usr/bin/env perl";
393 String secondLine = "#" + FIRST_LICENSE_LINE;
394
395 commonTestTemplate(filename, new FileCreator() {
396 public void createFile(Writer writer)
397 throws IOException {
398 writer.write(firstLine + "\n");
399 writer.write("print \"Hello world\"\n");
400 }
401 },
402 checkLines(firstLine, secondLine));
403 }
404
405 @Test
406 public void addLicenseToTclWithoutHashBang()
407 throws IOException {
408 String filename = "tmp.tcl";
409 String firstLine = "#" + FIRST_LICENSE_LINE;
410
411 commonTestTemplate(filename, new FileCreator() {
412 public void createFile(Writer writer)
413 throws IOException {
414 writer.write("puts \"Hello world\"\n");
415 }
416 },
417 checkLines(firstLine, null));
418 }
419
420 @Test
421 public void addLicenseToTclWithHashBang() throws IOException {
422 String filename = "tmp.tcl";
423 final String firstLine = "#!/usr/bin/env tcl";
424 String secondLine = "#" + FIRST_LICENSE_LINE;
425
426 commonTestTemplate(filename, new FileCreator() {
427 public void createFile(Writer writer)
428 throws IOException {
429 writer.write(firstLine + "\n");
430 writer.write("puts \"Hello world\"\n");
431 }
432 },
433 checkLines(firstLine, secondLine));
434 }
435
436 @Test
437 public void addLicenseToPHP() throws IOException {
438 String filename = "tmp.php";
439 final String firstLine = "<?php";
440 final String secondLine = "";
441 final String thirdLine = "/*";
442
443 commonTestTemplate(filename, new FileCreator() {
444 public void createFile(Writer writer)
445 throws IOException {
446 writer.write(firstLine + "\n");
447 writer.write("echo 'Hello World'\n");
448 writer.write("?>\n");
449 }
450 },
451 checkLines(firstLine, secondLine, thirdLine));
452 }
453
454 @Test
455 public void addLicenseToCSharp() throws IOException {
456 String filename = "tmp.cs";
457 String firstLine = "/*";
458
459 commonTestTemplate(filename, new FileCreator() {
460 public void createFile(Writer writer)
461 throws IOException {
462 writer.write("namespace org.example {\n");
463 writer.write(" public class Foo {\n");
464 writer.write(" }\n");
465 writer.write("}\n");
466 }
467 },
468 checkLines(firstLine, null));
469 }
470
471 @Test
472 public void addLicenseToGroovy() throws IOException {
473 String filename = "tmp.groovy";
474 String firstLine = "/*";
475
476 commonTestTemplate(filename, new FileCreator() {
477 public void createFile(Writer writer)
478 throws IOException {
479 writer.write("package org.example \n");
480 writer.write(" class Foo {\n");
481 writer.write(" }\n");
482 }
483 },
484 checkLines(firstLine, null));
485 }
486
487 @Test
488 public void addLicenseToCPlusPlus() throws IOException {
489 String filename = "tmp.cpp";
490 String firstLine = "/*";
491
492 commonTestTemplate(filename, new FileCreator() {
493 public void createFile(Writer writer)
494 throws IOException {
495 writer.write("namespace org.example {\n");
496 writer.write(" public class Foo {\n");
497 writer.write(" }\n");
498 writer.write("}\n");
499 }
500 },
501 checkLines(firstLine, null));
502 }
503
504 @Test
505 public void fileWithBOM() throws IOException {
506 File f = Resources.getResourceFile("violations/FilterTest.cs");
507 try {
508 ApacheV2LicenseAppender appender =
509 new ApacheV2LicenseAppender();
510 appender.append(f);
511
512 BufferedReader r = null;
513 try {
514 r = new BufferedReader(new FileReader(f.getAbsolutePath()
515 + ".new"));
516 assertEquals("/*", r.readLine());
517 String line = null;
518 while ((line = r.readLine()) != null) {
519 if (line.trim().length() == 0) {
520 break;
521 }
522 }
523 assertEquals("#if NET_2_0", r.readLine());
524 } finally {
525 IOUtils.closeQuietly(r);
526 }
527 } finally {
528 tryToDelete(new File(f.getAbsolutePath() + ".new"));
529 }
530 }
531
532 @Test
533 public void addLicenseToVS2003solution() throws IOException {
534 String filename = "tmp.sln";
535 final String firstLine = "Microsoft Visual Studio Solution File,"
536 + " Format Version 8.0";
537 String secondLine = "#" + FIRST_LICENSE_LINE;
538
539 commonTestTemplate(filename, new FileCreator() {
540 public void createFile(Writer writer)
541 throws IOException {
542 writer.write(firstLine + "\n");
543 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp\", \"Tutorials\\ConsoleApp\\cs\\src\\ConsoleApp.csproj\", \"{933969DF-2BC5-44E6-8B1A-400FC276A23F}\"\n");
544 writer.write("\tProjectSection(WebsiteProperties) = preProject\n");
545 writer.write("\t\tDebug.AspNetCompiler.Debug = \"True\"\n");
546 writer.write("\t\tRelease.AspNetCompiler.Debug = \"False\"\n");
547 writer.write("\tEndProjectSection\n");
548 writer.write("EndProject\n");
549 }
550 },
551 checkLines(firstLine, secondLine));
552 }
553
554 @Test
555 public void addLicenseToVS2005solution() throws IOException {
556 String filename = "tmp.sln";
557 final String firstLine = "Microsoft Visual Studio Solution File,"
558 + " Format Version 9.0";
559 final String secondLine = "# Visual Studio 2005";
560 final String thirdLine = "#" + FIRST_LICENSE_LINE;
561
562 commonTestTemplate(filename, new FileCreator() {
563 public void createFile(Writer writer)
564 throws IOException {
565 writer.write(firstLine + "\n");
566 writer.write(secondLine + "\n");
567 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleApp\", \"Tutorials\\ConsoleApp\\cs\\src\\ConsoleApp.csproj\", \"{933969DF-2BC5-44E6-8B1A-400FC276A23F}\"\n");
568 writer.write("\tProjectSection(WebsiteProperties) = preProject\n");
569 writer.write("\t\tDebug.AspNetCompiler.Debug = \"True\"\n");
570 writer.write("\t\tRelease.AspNetCompiler.Debug = \"False\"\n");
571 writer.write("\tEndProjectSection\n");
572 writer.write("EndProject\n");
573 }
574 },
575 new NewFileReader() {
576 public void readFile(BufferedReader r) throws IOException {
577 String line = r.readLine();
578 assertEquals("First line is incorrect",
579 firstLine, line);
580 line = r.readLine();
581 assertEquals("Second line is incorrect",
582 secondLine, line);
583 line = r.readLine();
584 assertEquals("Third line is incorrect",
585 thirdLine, line);
586 }
587 });
588 }
589
590 @Test
591 public void addLicenseToVS2010ExpressSolution() throws IOException {
592 String filename = "tmp.sln";
593 final String firstLine = "Microsoft Visual Studio Solution File, "
594 + "Format Version 11.00";
595 final String secondLine = "# Visual C# Express 2010";
596 final String thirdLine = "#" + FIRST_LICENSE_LINE;
597
598 commonTestTemplate(filename, new FileCreator() {
599 public void createFile(Writer writer)
600 throws IOException {
601 writer.write(firstLine + "\n");
602 writer.write(secondLine + "\n");
603 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Lucene.Net\", \"..\\..\\..\\src\\core\\Lucene.Net.csproj\", \"{5D4AD9BE-1FFB-41AB-9943-25737971BF57}\"\n");
604 writer.write("EndProject\n");
605 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Contrib.Highlighter\", \"..\\..\\..\\src\\contrib\\Highlighter\\Contrib.Highlighter.csproj\", \"{901D5415-383C-4AA6-A256-879558841BEA}\"\n");
606 writer.write("EndProject\n");
607 writer.write("Global\n");
608 writer.write("GlobalSection(SolutionConfigurationPlatforms) = preSolution\n");
609 writer.write("Debug|Any CPU = Debug|Any CPU\n");
610 writer.write("Release|Any CPU = Release|Any CPU\n");
611 writer.write("EndGlobalSection\n");
612 writer.write("GlobalSection(ProjectConfigurationPlatforms) = postSolution\n");
613 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
614 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
615 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
616 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU\n");
617 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
618 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
619 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
620 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.Build.0 = Release|Any CPU\n");
621 writer.write("EndGlobalSection\n");
622 writer.write("GlobalSection(SolutionProperties) = preSolution\n");
623 writer.write("HideSolutionNode = FALSE\n");
624 writer.write("EndGlobalSection\n");
625 writer.write("EndGlobal \n");
626 }
627 },
628 new NewFileReader() {
629 public void readFile(BufferedReader r) throws IOException {
630 String line = r.readLine();
631 assertEquals("First line is incorrect",
632 firstLine, line);
633 line = r.readLine();
634 assertEquals("Second line is incorrect",
635 secondLine, line);
636 line = r.readLine();
637 assertEquals("Third line is incorrect",
638 thirdLine, line);
639 }
640 });
641 }
642
643 @Test
644 public void addLicenseToVS2010SolutionWithBlankLine() throws IOException {
645 String filename = "tmp.sln";
646 final String firstLine = "";
647 final String secondLine = "Microsoft Visual Studio Solution File, "
648 + "Format Version 11.00";
649 final String thirdLine = "# Visual C# Express 2010";
650 final String forthLine = "#" + FIRST_LICENSE_LINE;
651
652 commonTestTemplate(filename, new FileCreator() {
653 public void createFile(Writer writer)
654 throws IOException {
655 writer.write(firstLine + "\n");
656 writer.write(secondLine + "\n");
657 writer.write(thirdLine + "\n");
658 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Lucene.Net\", \"..\\..\\..\\src\\core\\Lucene.Net.csproj\", \"{5D4AD9BE-1FFB-41AB-9943-25737971BF57}\"\n");
659 writer.write("EndProject\n");
660 writer.write("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Contrib.Highlighter\", \"..\\..\\..\\src\\contrib\\Highlighter\\Contrib.Highlighter.csproj\", \"{901D5415-383C-4AA6-A256-879558841BEA}\"\n");
661 writer.write("EndProject\n");
662 writer.write("Global\n");
663 writer.write("GlobalSection(SolutionConfigurationPlatforms) = preSolution\n");
664 writer.write("Debug|Any CPU = Debug|Any CPU\n");
665 writer.write("Release|Any CPU = Release|Any CPU\n");
666 writer.write("EndGlobalSection\n");
667 writer.write("GlobalSection(ProjectConfigurationPlatforms) = postSolution\n");
668 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
669 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
670 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
671 writer.write("{5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU\n");
672 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n");
673 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n");
674 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n");
675 writer.write("{901D5415-383C-4AA6-A256-879558841BEA}.Release|Any CPU.Build.0 = Release|Any CPU\n");
676 writer.write("EndGlobalSection\n");
677 writer.write("GlobalSection(SolutionProperties) = preSolution\n");
678 writer.write("HideSolutionNode = FALSE\n");
679 writer.write("EndGlobalSection\n");
680 writer.write("EndGlobal \n");
681 }
682 },
683 new NewFileReader() {
684 public void readFile(BufferedReader r) throws IOException {
685 String line = r.readLine();
686 assertEquals("First line is incorrect",
687 firstLine, line);
688 line = r.readLine();
689 assertEquals("Second line is incorrect",
690 secondLine, line);
691 line = r.readLine();
692 assertEquals("Third line is incorrect",
693 thirdLine, line);
694 line = r.readLine();
695 assertEquals("Forth line is incorrect",
696 forthLine, line);
697 }
698 });
699 }
700 }