File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
main/java/org/metafacture/io
test/java/org/metafacture/io Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ public void process(final T obj) {
108
108
@ Override
109
109
public void resetStream () {
110
110
closeStream ();
111
- startNewFile ();
112
111
++count ;
112
+ startNewFile ();
113
113
}
114
114
115
115
@ Override
Original file line number Diff line number Diff line change 17
17
package org .metafacture .io ;
18
18
19
19
import static org .junit .Assert .assertArrayEquals ;
20
+ import static org .junit .Assert .assertTrue ;
20
21
import static org .junit .Assume .assumeFalse ;
21
22
22
23
import java .io .File ;
@@ -93,6 +94,17 @@ public void shouldAppendToExistingFile() throws IOException {
93
94
assertOutput (DATA + "\n " + DATA + "\n " );
94
95
}
95
96
97
+ @ Test
98
+ public void shouldIncrementCountOnResetBeforeStartingNewFile () throws IOException {
99
+ final String pathWithVar = tempFolder .getRoot () + "/test-${i}" ;
100
+ writer = new ObjectFileWriter <String >(pathWithVar );
101
+ writer .process (DATA );
102
+ assertTrue (new File (tempFolder .getRoot (), "test-0" ).exists ());
103
+ writer .resetStream (); // increments count, starts new file
104
+ writer .process (DATA );
105
+ assertTrue (new File (tempFolder .getRoot (), "test-1" ).exists ());
106
+ }
107
+
96
108
@ Override
97
109
protected ConfigurableObjectWriter <String > getWriter () {
98
110
return writer ;
You can’t perform that action at this time.
0 commit comments