File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
testlib/src/main/java/com/diffplug/spotless Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -235,30 +235,41 @@ private WriteAsserter(File file) {
235235 this .file = file ;
236236 }
237237
238- public File toLines (String ... lines ) {
238+ public WriteAsserter toLines (String ... lines ) {
239239 return toContent (String .join ("\n " , Arrays .asList (lines )));
240240 }
241241
242- public File toContent (String content ) {
242+ public WriteAsserter toContent (String content ) {
243243 return toContent (content , StandardCharsets .UTF_8 );
244244 }
245245
246- public File toContent (String content , Charset charset ) {
246+ public WriteAsserter toContent (String content , Charset charset ) {
247247 ThrowingEx .run (() -> {
248248 Files .write (file .toPath (), content .getBytes (charset ));
249249 });
250- return file ;
250+ return this ;
251251 }
252252
253- public File toResource (String path ) {
253+ public WriteAsserter toResource (String path ) {
254254 ThrowingEx .run (() -> {
255255 Files .write (file .toPath (), getTestResource (path ).getBytes (StandardCharsets .UTF_8 ));
256256 });
257- return file ;
257+ return this ;
258258 }
259259
260- public File deleted () throws IOException {
260+ public WriteAsserter deleted () throws IOException {
261261 Files .delete (file .toPath ());
262+ return this ;
263+ }
264+
265+ public WriteAsserter makeExecutable () {
266+ if (!file .setExecutable (true )) {
267+ throw ThrowingEx .asRuntime (new IOException ("Failed to set executable flag on " + file ));
268+ }
269+ return this ;
270+ }
271+
272+ public File getFile () {
262273 return file ;
263274 }
264275 }
You can’t perform that action at this time.
0 commit comments