Skip to content

Commit

Permalink
Merge pull request #343 from udda1996/fix-indexing
Browse files Browse the repository at this point in the history
Fix remove command test
  • Loading branch information
udda1996 authored Feb 7, 2024
2 parents b3a30f5 + 983f521 commit 4f165cf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/test/java/org/ballerinalang/command/RemoveCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* @since 2.0.0
*/
public class RemoveCommandTest extends CommandTest {
String swanLakeLatestVersion = System.getProperty("swan-lake-latest-version");

@Test
public void removeCommandwithoutArgsTest() {
Expand Down Expand Up @@ -101,11 +102,15 @@ public void removeCommandTest() {
new CommandLine(removeCommand1).parse("2201.8.0");
removeCommand1.execute();
Assert.assertTrue(outContent.toString().contains("successfully removed"));
Assert.assertTrue(outContent.toString().contains("Deleting the dependency"));

RemoveCommand removeCommand2 = new RemoveCommand(testStream);
new CommandLine(removeCommand2).parse("2201.5.0");
new CommandLine(removeCommand2).parse(swanLakeLatestVersion);
removeCommand2.execute();
Assert.assertTrue(outContent.toString().contains("Deleting the dependency"));

RemoveCommand removeCommand3 = new RemoveCommand(testStream);
new CommandLine(removeCommand3).parse("2201.5.0");
removeCommand3.execute();
Assert.assertTrue(outContent.toString().contains("successfully removed"));

try {
Expand All @@ -116,14 +121,14 @@ public void removeCommandTest() {
Assert.assertTrue(e.getMessages().get(0).contains("distribution '2201.3.5' not found"));
}

RemoveCommand removeCommand3 = new RemoveCommand(testStream);
new CommandLine(removeCommand3).parse("-a");
removeCommand3.execute();
Assert.assertTrue(outContent.toString().contains("All non-active distributions are successfully removed"));

RemoveCommand removeCommand4 = new RemoveCommand(testStream);
new CommandLine(removeCommand4).parse("-a");
removeCommand4.execute();
Assert.assertTrue(outContent.toString().contains("All non-active distributions are successfully removed"));

RemoveCommand removeCommand5 = new RemoveCommand(testStream);
new CommandLine(removeCommand5).parse("-a");
removeCommand5.execute();
Assert.assertTrue(outContent.toString().contains("There is nothing to remove. Only active distribution is remaining"));
}

Expand Down

0 comments on commit 4f165cf

Please sign in to comment.