@@ -305,49 +305,109 @@ public void cannot_be_put_after_the_test_is_finished() {
305305 }
306306 }
307307
308+ @ RunWith (Enclosed .class )
308309 public static class directory_creation {
309- @ Test
310- public void a_directory_that_is_created_with_the_rule_can_be_read_by_a_client () {
311- FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
312- executeTestWithRule (
313- () -> {
314- sftpServer .createDirectory ("/a/directory" );
315- assertEmptyDirectory (sftpServer , "/a/directory" );
316- },
317- sftpServer
318- );
319- }
320310
321- @ Test
322- public void a_directory_cannot_be_created_before_the_test_is_started () {
323- FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
324- Throwable exception = exceptionThrownBy (
325- () -> sftpServer .createDirectory ("/a/directory" )
326- );
327- assertThat (exception )
328- .isInstanceOf (IllegalStateException .class )
329- .hasMessage (
330- "Failed to create directory because test has not been"
331- + " started or is already finished."
311+ public static class a_single_directory {
312+ @ Test
313+ public void that_is_created_with_the_rule_can_be_read_by_a_client () {
314+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
315+ executeTestWithRule (
316+ () -> {
317+ sftpServer .createDirectory ("/a/directory" );
318+ assertEmptyDirectory (sftpServer , "/a/directory" );
319+ },
320+ sftpServer
321+ );
322+ }
323+
324+ @ Test
325+ public void cannot_be_created_before_the_test_is_started () {
326+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
327+ Throwable exception = exceptionThrownBy (
328+ () -> sftpServer .createDirectory ("/a/directory" )
332329 );
330+ assertThat (exception )
331+ .isInstanceOf (IllegalStateException .class )
332+ .hasMessage (
333+ "Failed to create directory because test has not been"
334+ + " started or is already finished."
335+ );
336+ }
337+
338+ @ Test
339+ public void cannot_be_created_after_the_test_is_finished () {
340+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
341+ executeTestWithRule (
342+ () -> {},
343+ sftpServer
344+ );
345+ Throwable exception = exceptionThrownBy (
346+ () -> sftpServer .createDirectory ("/a/directory" )
347+ );
348+ assertThat (exception )
349+ .isInstanceOf (IllegalStateException .class )
350+ .hasMessage (
351+ "Failed to create directory because test has not been"
352+ + " started or is already finished."
353+ );
354+ }
333355 }
334356
335- @ Test
336- public void a_directory_cannot_be_created_after_the_test_is_finished () {
337- FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
338- executeTestWithRule (
339- () -> {},
340- sftpServer
341- );
342- Throwable exception = exceptionThrownBy (
343- () -> sftpServer .createDirectory ("/a/directory" )
344- );
345- assertThat (exception )
346- .isInstanceOf (IllegalStateException .class )
347- .hasMessage (
348- "Failed to create directory because test has not been"
349- + " started or is already finished."
357+ public static class multiple_directories {
358+ @ Test
359+ public void that_are_created_with_the_rule_can_be_read_by_a_client () {
360+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
361+ executeTestWithRule (
362+ () -> {
363+ sftpServer .createDirectories (
364+ "/a/directory" ,
365+ "/another/directory"
366+ );
367+ assertEmptyDirectory (sftpServer , "/a/directory" );
368+ assertEmptyDirectory (sftpServer , "/another/directory" );
369+ },
370+ sftpServer
371+ );
372+ }
373+
374+ @ Test
375+ public void cannot_be_created_before_the_test_is_started () {
376+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
377+ Throwable exception = exceptionThrownBy (
378+ () -> sftpServer .createDirectories (
379+ "/a/directory" ,
380+ "/another/directory"
381+ )
350382 );
383+ assertThat (exception )
384+ .isInstanceOf (IllegalStateException .class )
385+ .hasMessage (
386+ "Failed to create directory because test has not been"
387+ + " started or is already finished."
388+ );
389+ }
390+
391+ @ Test
392+ public void cannot_be_created_after_the_test_is_finished () {
393+ FakeSftpServerRule sftpServer = new FakeSftpServerRule ();
394+ executeTestWithRule (
395+ () -> {},
396+ sftpServer
397+ );
398+ Throwable exception = exceptionThrownBy (
399+ () -> sftpServer .createDirectories (
400+ "/a/directory" ,
401+ "/another/directory"
402+ )
403+ );
404+ assertThat (exception )
405+ .isInstanceOf (IllegalStateException .class )
406+ .hasMessage (
407+ "Failed to create directory because test has not been"
408+ + " started or is already finished."
409+ );
410+ }
351411 }
352412
353413 private static void assertEmptyDirectory (
0 commit comments