cleanup generated files (#1705)
* upgrade to spring boot 1.5.2
* add full update to REST API
* modify ratings controller
* upgrade herold
* fix integration test
* fix integration test
* minor fix
* fix integration test
* fix integration test
* minor cleanup
* minor cleanup
* remove log4j properties
* use standard logbook.xml
* remove log4j dependencies
* remove commons-logging
* merge
* fix conflict
* exclude commons-logging dependency
* cleanup
* minor fix
* minor fix
* fix dependency issues
* Revert "fix dependency issues"
This reverts commit 83bf1f9fd2.
* fix dependency issues
* minor fix
* minor fix
* minor fix
* cleanup generated files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.baeldung.shell.simple;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -15,13 +16,18 @@ public class SimpleCLIUnitTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void startUp() throws InterruptedException {
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
final Bootstrap bootstrap = new Bootstrap();
|
||||
shell = bootstrap.getJLineShellComponent();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void shutdown() {
|
||||
shell.stop();
|
||||
// delete contents.txt
|
||||
final File testFile = new File("contents.txt");
|
||||
if (testFile.exists()) {
|
||||
testFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static JLineShellComponent getShell() {
|
||||
@@ -31,7 +37,7 @@ public class SimpleCLIUnitTest {
|
||||
@Test
|
||||
public void givenCommandConfig_whenExecutingWebGetCommand_thenCorrectResult() {
|
||||
|
||||
CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com");
|
||||
final CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com");
|
||||
|
||||
Assert.assertTrue(resultWebSave.isSuccess());
|
||||
}
|
||||
@@ -40,37 +46,27 @@ public class SimpleCLIUnitTest {
|
||||
public void givenCommandConfig_whenExecutingWebSaveCommand_thenCorrectResult() {
|
||||
|
||||
shell.executeCommand("admin-enable");
|
||||
CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
final CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
|
||||
Assert.assertArrayEquals(
|
||||
new boolean[]{
|
||||
result.isSuccess(),
|
||||
new File("contents.txt").exists()},
|
||||
new boolean[]{true, true});
|
||||
Assert.assertArrayEquals(new boolean[] { result.isSuccess(), new File("contents.txt").exists() }, new boolean[] { true, true });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCommandConfig_whenAdminEnableCommandExecuted_thenCorrectAvailability() {
|
||||
|
||||
CommandResult resultAdminDisable = shell.executeCommand("admin-disable");
|
||||
CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
CommandResult resultAdminEnable = shell.executeCommand("admin-enable");
|
||||
CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
|
||||
Assert.assertArrayEquals(
|
||||
new boolean[]{
|
||||
resultAdminDisable.isSuccess(),
|
||||
resultWebSaveUnavailable.isSuccess(),
|
||||
resultAdminEnable.isSuccess(),
|
||||
resultWebSaveAvailable.isSuccess()},
|
||||
new boolean[]{true, false, true, true});
|
||||
final CommandResult resultAdminDisable = shell.executeCommand("admin-disable");
|
||||
final CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
final CommandResult resultAdminEnable = shell.executeCommand("admin-enable");
|
||||
final CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
|
||||
|
||||
Assert.assertArrayEquals(new boolean[] { resultAdminDisable.isSuccess(), resultWebSaveUnavailable.isSuccess(), resultAdminEnable.isSuccess(), resultWebSaveAvailable.isSuccess() }, new boolean[] { true, false, true, true });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCommandConfig_whenWebSaveCommandExecutedNoOutArgument_thenError() {
|
||||
|
||||
shell.executeCommand("admin-enable");
|
||||
CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com");
|
||||
final CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com");
|
||||
|
||||
Assert.assertEquals(resultWebSave.isSuccess(), false);
|
||||
}
|
||||
@@ -78,7 +74,7 @@ public class SimpleCLIUnitTest {
|
||||
@Test
|
||||
public void givenCommandConfig_whenExecutingWebGetCommandWithDefaultArgument_thenCorrectResult() {
|
||||
|
||||
CommandResult result = shell.executeCommand("web-get https://www.google.com");
|
||||
final CommandResult result = shell.executeCommand("web-get https://www.google.com");
|
||||
|
||||
Assert.assertEquals(result.isSuccess(), true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user