@Test void testChangeOwnershipOfDirectoryMethodFailure() throws IOException { final String user = "user"; final String dir = "dir"; Mockito.when(this.executor.execute(Mockito.any(CommandLine.class))).thenThrow(new IOException()); Assertions.assertThatIOException().isThrownBy(() -> UNIXUtils.changeOwnershipOfDirectory(dir, user, executor)); }
public static void changeOwnershipOfDirectory( final String dir, final String user, final Executor executor ) throws IOException { final CommandLine commandLine = new CommandLine(SUDO) .addArgument("chown") .addArgument("-R") .addArgument(user) .addArgument(dir); executor.execute(commandLine); }
UNIXUtils { public static void changeOwnershipOfDirectory( final String dir, final String user, final Executor executor ) throws IOException { final CommandLine commandLine = new CommandLine(SUDO) .addArgument("chown") .addArgument("-R") .addArgument(user) .addArgument(dir); executor.execute(commandLine); } }
UNIXUtils { public static void changeOwnershipOfDirectory( final String dir, final String user, final Executor executor ) throws IOException { final CommandLine commandLine = new CommandLine(SUDO) .addArgument("chown") .addArgument("-R") .addArgument(user) .addArgument(dir); executor.execute(commandLine); } private  UNIXUtils(); }
UNIXUtils { public static void changeOwnershipOfDirectory( final String dir, final String user, final Executor executor ) throws IOException { final CommandLine commandLine = new CommandLine(SUDO) .addArgument("chown") .addArgument("-R") .addArgument(user) .addArgument(dir); executor.execute(commandLine); } private  UNIXUtils(); static synchronized void createUser(
        final String user,
        @Nullable final String group,
        final Executor executor
    ); static void changeOwnershipOfDirectory(
        final String dir,
        final String user,
        final Executor executor
    ); }
UNIXUtils { public static void changeOwnershipOfDirectory( final String dir, final String user, final Executor executor ) throws IOException { final CommandLine commandLine = new CommandLine(SUDO) .addArgument("chown") .addArgument("-R") .addArgument(user) .addArgument(dir); executor.execute(commandLine); } private  UNIXUtils(); static synchronized void createUser(
        final String user,
        @Nullable final String group,
        final Executor executor
    ); static void changeOwnershipOfDirectory(
        final String dir,
        final String user,
        final Executor executor
    );  }