diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java index 950613f5548..63f7135ba2d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java @@ -144,12 +144,11 @@ public class SpringCli { * @throws Exception */ protected void run(String... args) throws Exception { - String commandName = "shell"; - if (args.length > 0) { - commandName = args[0]; + if (args.length == 0) { + throw new NoArgumentsException(); } - String[] commandArguments = args.length > 1 ? Arrays.copyOfRange(args, 1, - args.length) : new String[0]; + String commandName = args[0]; + String[] commandArguments = Arrays.copyOfRange(args, 1, args.length); Command command = find(commandName); if (command == null) { throw new NoSuchCommandException(commandName); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java deleted file mode 100644 index b2eb441da3a..00000000000 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/Shell.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.cli.command; - -import java.io.IOException; - -import org.springframework.boot.cli.SpringCli; - -/** - * @author Dave Syer - */ -public class Shell { - - public static void main(String... args) throws IOException { - if (args.length == 0) { - SpringCli.main("shell"); // right into the REPL by default - } - else { - SpringCli.main(args); - } - } - -} diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SpringCliTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SpringCliTests.java index 56e0df0da75..9602b77311b 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SpringCliTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SpringCliTests.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.springframework.boot.cli.SpringCli.NoArgumentsException; import org.springframework.boot.cli.SpringCli.NoHelpCommandArgumentsException; import static org.hamcrest.Matchers.equalTo; @@ -91,8 +92,8 @@ public class SpringCliTests { @Test public void runWithoutArguments() throws Exception { + this.thrown.expect(NoArgumentsException.class); this.cli.run(); - verify(this.shellCommand).run(); } @Test