@@ -115,12 +115,11 @@ void watchSingleFile() throws IOException {
115115 }
116116
117117 @ Test
118- @ Disabled
119- void moveRegularFileBetweenNestedDirectories () throws IOException {
118+ void moveRegularFile () throws IOException {
120119 var parent = testDir .getTestDirectory ();
121120 var child1 = Files .createDirectories (parent .resolve ("from" ));
122121 var child2 = Files .createDirectories (parent .resolve ("to" ));
123- var file = Files .createFile (child1 .resolve ("file.txt" ));
122+ var regularFile = Files .createFile (child1 .resolve ("file.txt" ));
124123
125124 var parentWatchBookkeeper = new TestHelper .Bookkeeper ();
126125 var parentWatchConfig = Watch
@@ -139,25 +138,25 @@ void moveRegularFileBetweenNestedDirectories() throws IOException {
139138
140139 var fileWatchBookkeeper = new TestHelper .Bookkeeper ();
141140 var fileWatchConfig = Watch
142- .build (file , WatchScope .PATH_ONLY )
141+ .build (regularFile , WatchScope .PATH_ONLY )
143142 .on (fileWatchBookkeeper );
144143
145144 try (var parentWatch = parentWatchConfig .start ();
146145 var child1Watch = child1WatchConfig .start ();
147146 var child2Watch = child2WatchConfig .start ();
148147 var fileWatch = fileWatchConfig .start ()) {
149148
150- var source = child1 .resolve (file .getFileName ());
151- var target = child2 .resolve (file .getFileName ());
149+ var source = child1 .resolve (regularFile .getFileName ());
150+ var target = child2 .resolve (regularFile .getFileName ());
152151 Files .move (source , target );
153152
154- await ( "Move should be observed as delete by `parent` watch (file tree)" )
155- . until (() -> parentWatchBookkeeper
156- . events (). kind ( DELETED ). rootPath ( parent ). relativePath ( parent . relativize (source )). any ());
157-
158- await ("Move should be observed as create by `parent` watch (file tree)" )
159- .until (() -> parentWatchBookkeeper
160- . events (). kind ( CREATED ). rootPath ( parent ). relativePath ( parent . relativize ( target )). any ());
153+ for ( var e : new WatchEvent [] {
154+ new WatchEvent ( DELETED , parent , parent . relativize ( source )),
155+ new WatchEvent ( CREATED , parent , parent . relativize (target ))
156+ }) {
157+ await ("Move should be observed as delete/ create by `parent` watch (file tree): " + e )
158+ .until (() -> parentWatchBookkeeper . events (). any ( e ));
159+ }
161160
162161 await ("Move should be observed as delete by `child1` watch (single directory)" )
163162 .until (() -> child1WatchBookkeeper
0 commit comments