@@ -226,7 +226,7 @@ void testBufferBreak() throws Exception {
226226
227227 final File file = new File (temporaryFolder , "testBufferBreak.txt" );
228228 createFile (file , 0 );
229- writeString (file , "SBTOURIST\n " );
229+ writeStrings (file , "SBTOURIST\n " );
230230
231231 final TestTailerListener listener = new TestTailerListener ();
232232 try (Tailer tailer = new Tailer (file , listener , delay , false , 1 )) {
@@ -366,7 +366,7 @@ void testIO335() throws Exception { // test CR behavior
366366 thread .start ();
367367
368368 // Write some lines to the file
369- writeString (file , "CRLF\r \n " , "LF\n " , "CR\r " , "CRCR\r \r " , "trail" );
369+ writeStrings (file , "CRLF\r \n " , "LF\n " , "CR\r " , "CRCR\r \r " , "trail" );
370370 final long testDelayMillis = delayMillis * 10 ;
371371 TestUtils .sleep (testDelayMillis );
372372 final List <String > lines = listener .getLines ();
@@ -592,7 +592,7 @@ void testTailer() throws Exception {
592592 thread .start ();
593593
594594 // Write some lines to the file
595- write (file , "Line one" , "Line two" );
595+ writeLines (file , "Line one" , "Line two" );
596596 final long testDelayMillis = delayMillis * 10 ;
597597 TestUtils .sleep (testDelayMillis );
598598 List <String > lines = listener .getLines ();
@@ -602,7 +602,7 @@ void testTailer() throws Exception {
602602 listener .clear ();
603603
604604 // Write another line to the file
605- write (file , "Line three" );
605+ writeLines (file , "Line three" );
606606 TestUtils .sleep (testDelayMillis );
607607 lines = listener .getLines ();
608608 assertEquals (1 , lines .size (), "2 line count" );
@@ -624,7 +624,7 @@ void testTailer() throws Exception {
624624 TestUtils .sleep (testDelayMillis );
625625
626626 // Write another line
627- write (file , "Line four" );
627+ writeLines (file , "Line four" );
628628 TestUtils .sleep (testDelayMillis );
629629 lines = listener .getLines ();
630630 assertEquals (1 , lines .size (), "4 line count" );
@@ -634,7 +634,7 @@ void testTailer() throws Exception {
634634 // Stop
635635 thread .interrupt ();
636636 TestUtils .sleep (testDelayMillis * 4 );
637- write (file , "Line five" );
637+ writeLines (file , "Line five" );
638638 assertEquals (0 , listener .getLines ().size (), "4 line count" );
639639 assertNotNull (listener .exception , "Missing InterruptedException" );
640640 assertTrue (listener .exception instanceof InterruptedException , "Unexpected Exception: " + listener .exception );
@@ -660,15 +660,15 @@ void testTailerEndOfFileReached() throws Exception {
660660 thread .start ();
661661
662662 // write a few lines
663- write (file , "line1" , "line2" , "line3" );
663+ writeLines (file , "line1" , "line2" , "line3" );
664664 TestUtils .sleep (testDelayMillis );
665665
666666 // write a few lines
667- write (file , "line4" , "line5" , "line6" );
667+ writeLines (file , "line4" , "line5" , "line6" );
668668 TestUtils .sleep (testDelayMillis );
669669
670670 // write a few lines
671- write (file , "line7" , "line8" , "line9" );
671+ writeLines (file , "line7" , "line8" , "line9" );
672672 TestUtils .sleep (testDelayMillis );
673673
674674 // May be > 3 times due to underlying OS behavior wrt streams
@@ -688,13 +688,13 @@ void testTailerEof() throws Exception {
688688 thread .start ();
689689
690690 // Write some lines to the file
691- writeString (file , "Line" );
691+ writeStrings (file , "Line" );
692692
693693 TestUtils .sleep (delayMillis * 2 );
694694 List <String > lines = listener .getLines ();
695695 assertEquals (0 , lines .size (), "1 line count" );
696696
697- writeString (file , " one\n " );
697+ writeStrings (file , " one\n " );
698698 TestUtils .sleep (delayMillis * 4 );
699699 lines = listener .getLines ();
700700
@@ -723,7 +723,7 @@ void testTailerIgnoreTouch() throws Exception {
723723 thread .start ();
724724
725725 // Write some lines to the file
726- write (file , "Line one" );
726+ writeLines (file , "Line one" );
727727 final long testDelayMillis = delayMillis * 10 ;
728728 TestUtils .sleep (testDelayMillis );
729729 List <String > lines = listener .getLines ();
@@ -757,7 +757,7 @@ void testTailerReissueOnTouch() throws Exception {
757757 thread .start ();
758758
759759 // Write some lines to the file
760- write (file , "Line one" );
760+ writeLines (file , "Line one" );
761761 final long testDelayMillis = delayMillis * 10 ;
762762 TestUtils .sleep (testDelayMillis );
763763 List <String > lines = listener .getLines ();
@@ -776,15 +776,15 @@ void testTailerReissueOnTouch() throws Exception {
776776 }
777777
778778 private void validateTailer (final TestTailerListener listener , final File file ) throws IOException , InterruptedException {
779- write (file , "foo" );
779+ writeLines (file , "foo" );
780780 final int timeout = 30 ;
781781 final TimeUnit timeoutUnit = TimeUnit .SECONDS ;
782782 assertTrue (listener .awaitExpectedLines (timeout , timeoutUnit ), () -> String .format ("await timed out after %s %s" , timeout , timeoutUnit ));
783783 assertEquals (listener .getLines (), Arrays .asList ("foo" ), "lines" );
784784 }
785785
786786 /** Appends lines to a file */
787- private void write (final File file , final String ... lines ) throws IOException {
787+ private void writeLines (final File file , final String ... lines ) throws IOException {
788788 try (Writer writer = Files .newBufferedWriter (file .toPath (), StandardOpenOption .APPEND )) {
789789 for (final String line : lines ) {
790790 writer .write (line + "\n " );
@@ -793,7 +793,7 @@ private void write(final File file, final String... lines) throws IOException {
793793 }
794794
795795 /** Appends strings to a file */
796- private void writeString (final File file , final String ... strings ) throws IOException {
796+ private void writeStrings (final File file , final String ... strings ) throws IOException {
797797 try (Writer writer = Files .newBufferedWriter (file .toPath (), StandardOpenOption .APPEND )) {
798798 for (final String string : strings ) {
799799 writer .write (string );
0 commit comments