@@ -181,9 +181,9 @@ func (s *osFileTest) TestCopyToLocation() {
181181 otherFile := mocks .NewFile (s .T ())
182182
183183 // Expected behavior
184- otherFile .On ( " Write" , mock .Anything ).Return (len (expectedText ), nil )
185- otherFile .On ( " Close" ).Return (nil )
186- otherFs .On ( " NewFile" , mock .Anything , mock .Anything ).Return (otherFile , nil )
184+ otherFile .EXPECT (). Write ( mock .Anything ).Return (len (expectedText ), nil )
185+ otherFile .EXPECT (). Close ( ).Return (nil )
186+ otherFs .EXPECT (). NewFile ( mock .Anything , mock .Anything ).Return (otherFile , nil )
187187
188188 location := Location {name : "/some/path" , fileSystem : otherFs }
189189
@@ -203,12 +203,12 @@ func (s *osFileTest) TestCopyToFile() {
203203 location := Location {name : "/some/path" , fileSystem : otherFs }
204204
205205 // Expected behavior
206- otherFile .On ( " Write" , []uint8 (expectedText )).Return (len (expectedText ), nil )
207- otherFile .On ( " Close" ).Return (nil )
208- otherFile .On ( " Name" ).Return ("other.txt" )
209- otherFile .On ( " Location" ).Return (vfs .Location (& location ))
206+ otherFile .EXPECT (). Write ( []uint8 (expectedText )).Return (len (expectedText ), nil )
207+ otherFile .EXPECT (). Close ( ).Return (nil )
208+ otherFile .EXPECT (). Name ( ).Return ("other.txt" )
209+ otherFile .EXPECT (). Location ( ).Return (vfs .Location (& location ))
210210
211- otherFs .On ( " NewFile" , "" , "/some/path/other.txt" ).Return (otherFile , nil )
211+ otherFs .EXPECT (). NewFile ( "" , "/some/path/other.txt" ).Return (otherFile , nil )
212212
213213 err := s .testFile .CopyToFile (otherFile )
214214 s .Require ().NoError (err )
@@ -222,12 +222,12 @@ func (s *osFileTest) TestEmptyCopyToFile() {
222222 location := Location {name : "/some/path" , fileSystem : otherFs }
223223
224224 // Expected behavior
225- otherFile .On ( " Write" , []uint8 (expectedText )).Return (len (expectedText ), nil )
226- otherFile .On ( " Close" ).Return (nil )
227- otherFile .On ( " Name" ).Return ("other.txt" )
228- otherFile .On ( " Location" ).Return (vfs .Location (& location ))
225+ otherFile .EXPECT (). Write ( []uint8 (expectedText )).Return (len (expectedText ), nil )
226+ otherFile .EXPECT (). Close ( ).Return (nil )
227+ otherFile .EXPECT (). Name ( ).Return ("other.txt" )
228+ otherFile .EXPECT (). Location ( ).Return (vfs .Location (& location ))
229229
230- otherFs .On ( " NewFile" , "" , "/some/path/other.txt" ).Return (otherFile , nil )
230+ otherFs .EXPECT (). NewFile ( "" , "/some/path/other.txt" ).Return (otherFile , nil )
231231
232232 emptyFile , err := s .tmploc .NewFile ("test_files/empty.txt" )
233233 s .Require ().NoError (err , "No file was opened" )
@@ -242,9 +242,9 @@ func (s *osFileTest) TestCopyToLocationIgnoreExtraSeparator() {
242242 otherFile := mocks .NewFile (s .T ())
243243
244244 // Expected behavior
245- otherFile .On ( " Write" , mock .Anything ).Return (len (expectedText ), nil )
246- otherFile .On ( " Close" ).Return (nil )
247- otherFs .On ( " NewFile" , "" , "/some/path/test.txt" ).Return (otherFile , nil )
245+ otherFile .EXPECT (). Write ( mock .Anything ).Return (len (expectedText ), nil )
246+ otherFile .EXPECT (). Close ( ).Return (nil )
247+ otherFs .EXPECT (). NewFile ( "" , "/some/path/test.txt" ).Return (otherFile , nil )
248248
249249 // Add trailing slash
250250 location := Location {name : "/some/path/" , fileSystem : otherFs }
@@ -295,19 +295,19 @@ func (s *osFileTest) TestMoveToLocation() {
295295 s .Require ().NoError (err )
296296
297297 // Expected behavior
298- mockfs .On ( " Scheme" ).Return ("mock" )
298+ mockfs .EXPECT (). Scheme ( ).Return ("mock" )
299299 fsMockFile := mocks .NewFile (s .T ())
300- fsMockFile .On ( " Write" , mock .Anything ).Return (10 , nil )
301- fsMockFile .On ( " Close" ).Return (nil )
302- mockfs .On ( " NewFile" , mock .Anything , mock .Anything ).Return (fsMockFile , nil )
303- mockLocation .On ( " FileSystem" ).Return (mockfs )
304- mockLocation .On ( " Authority" ).Return (auth )
305- mockLocation .On ( " Path" ).Return ("/some/path/to/" )
300+ fsMockFile .EXPECT (). Write ( mock .Anything ).Return (10 , nil )
301+ fsMockFile .EXPECT (). Close ( ).Return (nil )
302+ mockfs .EXPECT (). NewFile ( mock .Anything , mock .Anything ).Return (fsMockFile , nil )
303+ mockLocation .EXPECT (). FileSystem ( ).Return (mockfs )
304+ mockLocation .EXPECT (). Authority ( ).Return (auth )
305+ mockLocation .EXPECT (). Path ( ).Return ("/some/path/to/" )
306306 mockFile := mocks .NewFile (s .T ())
307- mockFile .On ( " Location" ).Return (mockLocation , nil )
308- mockFile .On ( " Name" ).Return ("/some/path/to/move.txt" )
309- mockFile .On ( " Location" ).Return (mockLocation , nil )
310- mockLocation .On ( " NewFile" , mock .Anything ).Return (mockFile , nil )
307+ mockFile .EXPECT (). Location ( ).Return (mockLocation )
308+ mockFile .EXPECT (). Name ( ).Return ("/some/path/to/move.txt" )
309+ mockFile .EXPECT (). Location ( ).Return (mockLocation )
310+ mockLocation .EXPECT (). NewFile ( mock .Anything ).Return (mockFile , nil )
311311
312312 _ , err = movedFile .MoveToLocation (mockLocation )
313313 s .Require ().NoError (err )
@@ -425,17 +425,17 @@ func (s *osFileTest) TestMoveToFile() {
425425 s .Require ().NoError (err )
426426
427427 // Expected behavior
428- mockfs .On ( " Scheme" ).Return ("mock" )
428+ mockfs .EXPECT (). Scheme ( ).Return ("mock" )
429429 fsMockFile := mocks .NewFile (s .T ())
430- fsMockFile .On ( " Write" , mock .Anything ).Return (13 , nil )
431- fsMockFile .On ( " Close" ).Return (nil )
432- mockfs .On ( " NewFile" , mock .Anything , mock .Anything ).Return (fsMockFile , nil )
433- mockLocation .On ( " FileSystem" ).Return (mockfs )
434- mockLocation .On ( " Authority" ).Return (auth )
435- mockLocation .On ( " Path" ).Return ("/some/path/to/" )
436- mockFile .On ( " Location" ).Return (mockLocation , nil )
437- mockFile .On ( " Name" ).Return ("/some/path/to/file.txt" )
438- mockFile .On ( " Location" ).Return (mockLocation , nil )
430+ fsMockFile .EXPECT (). Write ( mock .Anything ).Return (13 , nil )
431+ fsMockFile .EXPECT (). Close ( ).Return (nil )
432+ mockfs .EXPECT (). NewFile ( mock .Anything , mock .Anything ).Return (fsMockFile , nil )
433+ mockLocation .EXPECT (). FileSystem ( ).Return (mockfs )
434+ mockLocation .EXPECT (). Authority ( ).Return (auth )
435+ mockLocation .EXPECT (). Path ( ).Return ("/some/path/to/" )
436+ mockFile .EXPECT (). Location ( ).Return (mockLocation )
437+ mockFile .EXPECT (). Name ( ).Return ("/some/path/to/file.txt" )
438+ mockFile .EXPECT (). Location ( ).Return (mockLocation )
439439
440440 s .Require ().NoError (file2 .MoveToFile (mockFile ))
441441}
0 commit comments