88import java .nio .charset .StandardCharsets ;
99import java .nio .file .Files ;
1010import java .nio .file .Path ;
11+
1112import org .frankframework .flow .exception .ApiException ;
1213import org .frankframework .flow .filesystem .FileSystemStorage ;
1314import org .frankframework .flow .project .Project ;
1415import org .frankframework .flow .project .ProjectNotFoundException ;
1516import org .frankframework .flow .project .ProjectService ;
17+
1618import org .junit .jupiter .api .BeforeEach ;
1719import org .junit .jupiter .api .Test ;
1820import org .junit .jupiter .api .extension .ExtendWith ;
@@ -56,13 +58,13 @@ private void stubReadFile() throws IOException {
5658
5759 private void stubWriteFile () throws IOException {
5860 doAnswer (invocation -> {
59- String path = invocation .getArgument (0 );
60- String content = invocation .getArgument (1 );
61- Path filePath = Path .of (path );
62- Files .createDirectories (filePath .getParent ());
63- Files .writeString (filePath , content , StandardCharsets .UTF_8 );
64- return null ;
65- })
61+ String path = invocation .getArgument (0 );
62+ String content = invocation .getArgument (1 );
63+ Path filePath = Path .of (path );
64+ Files .createDirectories (filePath .getParent ());
65+ Files .writeString (filePath , content , StandardCharsets .UTF_8 );
66+ return null ;
67+ })
6668 .when (fileSystemStorage )
6769 .writeFile (anyString (), anyString ());
6870 }
@@ -81,7 +83,7 @@ void getConfigurationContent_Success() throws Exception {
8183 }
8284
8385 @ Test
84- void getConfigurationContent_FileNotFound_ThrowsConfigurationNotFoundException () throws IOException {
86+ void getConfigurationContent_FileNotFound_ThrowsConfigurationNotFoundException () {
8587 stubToAbsolutePath ();
8688
8789 String path = tempDir .resolve ("missing.xml" ).toString ();
@@ -97,7 +99,8 @@ void getConfigurationContent_IsDirectory_ThrowsConfigurationNotFoundException()
9799
98100 assertThrows (
99101 ApiException .class ,
100- () -> configurationService .getConfigurationContent ("test" , dir .toString ()));
102+ () -> configurationService .getConfigurationContent ("test" , dir .toString ())
103+ );
101104 }
102105
103106 @ Test
@@ -115,14 +118,15 @@ void updateConfiguration_Success() throws Exception {
115118 }
116119
117120 @ Test
118- void updateConfiguration_FileNotFound_ThrowsConfigurationNotFoundException () throws IOException {
121+ void updateConfiguration_FileNotFound_ThrowsConfigurationNotFoundException () {
119122 stubToAbsolutePath ();
120123
121124 String path = tempDir .resolve ("missing.xml" ).toString ();
122125
123126 assertThrows (
124127 ApiException .class ,
125- () -> configurationService .updateConfiguration ("test" , path , "<new/>" ));
128+ () -> configurationService .updateConfiguration ("test" , path , "<new/>" )
129+ );
126130 }
127131
128132 @ Test
@@ -199,7 +203,8 @@ void addConfigurationToFolder_AlreadyExists_ThrowsException() throws Exception {
199203 assertThrows (
200204 ConfigurationAlreadyExistsException .class ,
201205 () -> configurationService .addConfigurationToFolder (
202- "myproject" , "existing.xml" , projectDir .toString ()));
206+ "myproject" , "existing.xml" , projectDir .toString ())
207+ );
203208 }
204209
205210 @ Test
@@ -216,6 +221,7 @@ void addConfigurationToFolder_OutsideProject_ThrowsSecurityException() throws Ex
216221
217222 assertThrows (
218223 SecurityException .class ,
219- () -> configurationService .addConfigurationToFolder ("myproject" , "evil.xml" , outsidePath ));
224+ () -> configurationService .addConfigurationToFolder ("myproject" , "evil.xml" , outsidePath )
225+ );
220226 }
221227}
0 commit comments