Skip to content

Commit

Permalink
Add test cases for command
Browse files Browse the repository at this point in the history
  • Loading branch information
udda1996 committed May 17, 2023
1 parent dda9fdf commit c32ef68
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/test/java/org/ballerinalang/command/PullCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @since 2.0.0
*/
public class PullCommandTest extends CommandTest {
String swanLakeLatestVersion = System.getProperty("swan-lake-latest-version");

@Test
public void pullCommandwithoutArgsTest() {
Expand Down Expand Up @@ -79,14 +80,18 @@ public void pullDistributionTest() {
Assert.assertTrue(outContent.toString().contains("Fetching the 'slp1' distribution from the remote server"));
Assert.assertTrue(outContent.toString().contains("Fetching the dependencies for 'slp1' from the remote server"));
Assert.assertTrue(outContent.toString().contains("successfully set as the active distribution"));
}

PullCommand pullCmd = new PullCommand(testStream);
new CommandLine(pullCmd).parse("latest");
pullCmd.execute();
@Test
public void pullLatestDistributionTest() {
PullCommand pullCommand = new PullCommand(testStream);
new CommandLine(pullCommand).parse("latest");
pullCommand.execute();
Assert.assertTrue(outContent.toString().contains("Fetching the latest distribution from the remote server"));
Assert.assertTrue(outContent.toString().contains("Fetching the '" + swanLakeLatestVersion + "' distribution from the remote server"));
Assert.assertTrue(outContent.toString().contains("successfully set as the active distribution"));

pullCommand.execute();
Assert.assertTrue(outContent.toString().contains("is already available locally"));
Assert.assertTrue(outContent.toString().contains("is already the active distribution"));
}
}

0 comments on commit c32ef68

Please sign in to comment.